从现有期望中编写自定义期望的天真方法是:
expect_failure
但这不适用于expect_failure
,因为expect_between(0.5, 0, 1) # PASSES
expect_between(-99, 0, 1) # FAILS
expect_between(99, 0, 1) # FAILS
expect_failure(expect_between(-99, 0, 1)) # PASSES
expect_failure(expect_between(99, 0, 1)) # FAILS <--- the problem
会抓住第一个期望。
expect_failure
在编写用户定义的期望时,构建期望的正确方法是什么,以便它们仍能与Group
一起使用?