示例#1
0
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
示例#2
0
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
示例#3
0
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
示例#4
0
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
示例#5
0
def test_cannot_install_into_morpher_twice():
    m = Morpher(0, 1)
    m.install(s.integers())
    with pytest.raises(InvalidArgument):
        m.install(s.integers())
示例#6
0
def test_cannot_install_into_morpher_twice():
    m = Morpher(0, 1)
    m.install(s.integers())
    with pytest.raises(InvalidArgument):
        m.install(s.integers())