def test_named_tuples_always_produce_named_tuples():
    s = strategy(Litter(int,int))

    for i in xrange(100):
        assert isinstance(s.produce(i, Flags()), Litter)

    for x in s.simplify(Litter(100,100)):
        assert isinstance(x, Litter)
Exemple #2
0
 def flags(self):
     r = set()
     self.add_flags_to(r)
     return Flags(r)
Exemple #3
0
 def generate_flags():
     return Flags([
         x
         for x in search_strategy.flags().flags
         if random() <= p])
def test_just_works():
    s = strategy(ss.just("giving"))
    assert s.produce(10,Flags()) == "giving"
    assert s.simplify_such_that("giving", lambda _ : True) == "giving"
Exemple #5
0
def test_can_disable_flags():
    flags = Flags(["foo"])
    assert flags.enabled("foo")
    flags2 = flags.with_disabled("foo")
    assert not flags2.enabled("foo")
Exemple #6
0
def test_str_contains_flags():
    assert "foo" in str(Flags(["foo"]))
    assert "foo" in str(Flags(["foo", "bar"]))
    assert "bar" in str(Flags(["foo", "bar"]))
Exemple #7
0
def test_enabling_flags_leaves_original_unchanged():
    flags = Flags()
    assert not flags.enabled("foo")
    flags2 = flags.with_enabled("foo")
    assert not flags.enabled("foo")
    assert flags2.enabled("foo")
Exemple #8
0
def test_flags_not_enabled_by_default():
    flags = Flags()
    assert not flags.enabled("foo")
Exemple #9
0
def test_can_disable_flags():
    flags = Flags(["foo"])
    assert flags.enabled("foo")
    flags2 = flags.with_disabled("foo")
    assert not flags2.enabled("foo")
Exemple #10
0
def test_enabling_flags_leaves_original_unchanged():
    flags = Flags()
    assert not flags.enabled("foo")
    flags2 = flags.with_enabled("foo")
    assert not flags.enabled("foo")
    assert flags2.enabled("foo")
Exemple #11
0
def test_flags_not_enabled_by_default():
    flags = Flags()
    assert not flags.enabled("foo")