Example #1
0
def test_exponent__bigger_reverse():
    sut = Scalar(3.76)

    assert eq_within_epsilon(8 ** sut, 2486.67)
Example #2
0
def test_floor_divide__int_float_scalar():
    sut = Scalar(1.5)

    assert eq_within_epsilon(5 // sut, 3)
Example #3
0
def test_exponent__bigger():
    sut = Scalar(3.76)

    assert eq_within_epsilon(sut ** 8, 39948.71)
Example #4
0
def test_floor_divide__float_scalar_int():
    sut = Scalar(3.33)

    assert eq_within_epsilon(sut // 3, 1)
Example #5
0
def test_floor_divide__int_scalar():
    sut = Scalar(3)

    assert eq_within_epsilon(2 // sut, 0)
Example #6
0
def test_multiply__scalar_float_scalar():
    sut = Scalar(3)
    sut2 = Scalar(4.2)

    assert eq_within_epsilon(sut * sut2, 12.6)
Example #7
0
def test_multiply__float_scalar_int():
    sut = Scalar(3.33)

    assert eq_within_epsilon(sut * 3, 9.99)
Example #8
0
def test_subtract__scalar_float_scalar():
    sut = Scalar(3)
    sut2 = Scalar(4.9)

    assert eq_within_epsilon(sut - sut2, -1.9)
Example #9
0
def test_subtract__float_scalar_int():
    sut = Scalar(3.33)

    assert eq_within_epsilon(sut - 3, 0.33)
Example #10
0
def test_fraction__messy():
    sut = Scalar(34, max=145)

    assert eq_within_epsilon(sut.fraction, 0.23)