Пример #1
0
def test_functions_for_zero():
    assert session3.float_equality_testing(
        0.0, 0.0), 'How can zero be not equal to zero?'
    assert session3.manual_truncation_function(
        0.0) == 0, 'Tuncation of 0 should be zero'
    assert session3.manual_rounding_function(
        0.0) == 0, 'Zero can only be rounded off to zero'
Пример #2
0
def test_manual_rounding_function():
    for f_num in [1.25, 1.35, -1.25, -1.35]:
        assert session3.manual_rounding_function(f_num) == round(
            f_num
        ), 'Terminator after looking at your code: I will be back! He will come back when you fix your rounding errors.'