我有
class A(st.SearchStrategy):
def do_draw(self, data):
return object_a(b=st.integers(), c=st.boolean()...)
class B(st.SearchStrategy):
def do_draw(self, data):
return object_a(d=st.boolean(), e=st.boolean()...)
@given(a=A(), b=B())
def test_A_and_B(a, b):
...
我如何确保一个测试用例
a = A(b=5, c=True)
# b can be anything
和一个测试用例
a = A(b=10, c=True)
b = B(c=True, d=<can be either T or F>)
生成?
我知道@example。这是正确的吗?
@given(a=A(), b=B())
@example(a=A(b=10, c=True), b=B(c=True, d=False)
# not sure how to set d to be either true or false
def test_A_and_B(a, b):
...