Exemplo n.º 1
0
def test_getAndSetEnumValues():
    calc = Calculator()
    calc.add(9)
    calc.pow(3)

    CompositeOperation = composition.CompositeOperation

    assert calc.string_style == CompositeOperation.CompositionStringStyle.NORMAL

    calc.string_style = CompositeOperation.CompositionStringStyle.DECORATED

    assert calc.string_style == CompositeOperation.CompositionStringStyle.DECORATED
    assert calc.to_string() == "<<[[{{(((1 * (0 + 9)) * (0 + 9)) * (0 + 9))}}]]>>"
Exemplo n.º 2
0
def test_callMethods():
    calc = Calculator()

    calc.add(10)
    assert calc.value == 10

    calc.mul(2)
    assert calc.value == 20

    calc.pow(5)
    assert calc.value == 20 ** 5

    calc.neg()
    assert calc.value == -3_200_000