示例#1
0
def test_terms():
    k = EQ() + EQ() * Linear() + RQ(1) * RQ(2) + Delta()
    yield eq, k.num_terms, 4
    yield eq, str(k.term(0)), 'EQ()'
    yield eq, str(k.term(1)), 'EQ() * Linear()'
    yield eq, str(k.term(2)), 'RQ(1) * RQ(2)'
    yield eq, str(k.term(3)), 'Delta()'
    yield raises, IndexError, lambda: k.term(4)
    yield raises, IndexError, lambda: EQ().term(1)
示例#2
0
def test_terms():
    k = EQ() + EQ() * Linear() + RQ(1) * RQ(2) + Delta()
    assert k.num_terms == 4
    assert str(k.term(0)) == 'EQ()'
    assert str(k.term(1)) == 'EQ() * Linear()'
    assert str(k.term(2)) == 'RQ(1) * RQ(2)'
    assert str(k.term(3)) == 'Delta()'
    with pytest.raises(IndexError):
        k.term(4)
    with pytest.raises(IndexError):
        EQ().term(1)