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

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

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

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

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

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

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

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

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

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

    assert eq_within_epsilon(sut.fraction, 0.23)