def test_effect(): e = Effect(['a', 'b'], ['m'], 'm=A') assert str(e) == 'm=A' e = Effect(['a', 'b'], ['m', 'n'], 'm=A, n=B') assert str(e) == 'm=A, n=B' e = Effect(['a', 'b'], ['m', 'n'], 'm=a, n=b*2*A') assert str(e) == 'm=a, n=(2 * A) * b' e = Effect(['a', 'b'], ['m'], 'm=0') assert str(e) == 'm=0' # Check that multiple lvalue=rvalue parsing is working with commas e = Effect(['a', 'b'], ['x', 'y', 'z'], 'x=a,y=dot(a,b),z=b') assert str(e) == 'x=a, y=dot(a, b), z=b' e = Effect(['a', 'b'], ['foo', 'bar'], ' foo = dot(a, b) , bar = b') assert str(e) == 'foo=dot(a, b), bar=b' with pytest.raises(SpaParseError): Effect(['a', 'b'], ['q'], 'q=z') with pytest.raises(SpaParseError): Effect(['a', 'b'], ['q'], 'q=a, q=b') # lvalue appears twice
def test_effect(): e = Effect(["a", "b"], ["m"], "m=A") assert str(e) == "m=A" e = Effect(["a", "b"], ["m", "n"], "m=A, n=B") assert str(e) == "m=A, n=B" e = Effect(["a", "b"], ["m", "n"], "m=a, n=b*2*A") assert str(e) == "m=a, n=(2 * A) * b" e = Effect(["a", "b"], ["m"], "m=0") assert str(e) == "m=0" # Check that multiple lvalue=rvalue parsing is working with commas e = Effect(["a", "b"], ["x", "y", "z"], "x=a,y=dot(a,b),z=b") assert str(e) == "x=a, y=dot(a, b), z=b" e = Effect(["a", "b"], ["foo", "bar"], " foo = dot(a, b) , bar = b") assert str(e) == "foo=dot(a, b), bar=b" with pytest.raises(SpaParseError): Effect(["a", "b"], ["q"], "q=z") with pytest.raises(SpaParseError): Effect(["a", "b"], ["q"], "q=a, q=b") # lvalue appears twice
def test_inverted(): with pytest.raises(SpaParseError): Effect(['b'], ['a'], 'a = ~2*b') with pytest.raises(SpaParseError): Effect(['b'], ['a'], 'a = ~2*C*b')
def test_inverted(): with pytest.raises(SpaParseError): Effect(["b"], ["a"], "a = ~2*b") with pytest.raises(SpaParseError): Effect(["b"], ["a"], "a = ~2*C*b")