Example #1
0
def test_pow():
    u = Unit(length, factor=10)

    assert u.pow(0) == 1
    assert u.pow(1) == u
    assert u.pow(2) == Unit(length.pow(2), factor=100)
    assert u.pow(-1) == Unit(length.pow(-1), factor=0.1)
Example #2
0
def test_mul():
    u = Unit(length, factor=10)

    assert u.mul(1) == u

    assert u.mul(Unit(time, factor=2)) == Unit(length.mul(time), factor=20)
    assert u.mul(Unit(length.pow(-1), factor=2)) == 20