def test_a_morpher_accumulates_strategies(): m = Morpher(1, 1) m.become(s.integers()) m.clear() m.become(s.text()) m.clear() assert len(m.data) == 2
def test_can_track_morphers(): t = Tracker() assert t.track(Morpher(0, 0)) == 1 assert t.track(Morpher(0, 0)) == 2 m1 = Morpher(0, 1) m2 = Morpher(0, 1) m1.become(s.lists(s.integers())) m2.become(s.lists(s.integers())) assert t.track(m1) == 1 assert t.track(m2) == 2
def test_cannot_install_into_morpher_twice(): m = Morpher(0, 1) m.install(s.integers()) with pytest.raises(InvalidArgument): m.install(s.integers())