예제 #1
0
def test_check_equal_int_0_10_10_pass_not_visible(caplog):
    checkv.pass_visible = False
    checkv.check_equal(0, 10, max_diff=10)
    checkv.pass_visible = True

    # check that no output happened
    assert len(caplog.records) == 0
    assert "" == caplog.text
예제 #2
0
def test_check_equal_int_my_checker__0_10_9_fail(caplog):
    checkv.check_equal(0, 10, max_diff=9, checker=my_checker)

    for record in caplog.records:
        assert record.levelname == "ERROR"
    assert "Equality check failed - Got abs (0 - 10) > 9." in caplog.text
예제 #3
0
def test_check_equal_int_my_checker__0_10_pass(caplog):
    checkv.check_equal(0, 10, max_diff=10, checker=my_checker)

    for record in caplog.records:
        assert record.levelname == "INFO"
    assert "Equality check passed - Got abs (0 - 10) <= 10." in caplog.text
예제 #4
0
def test_check_equal_int_0_10_fail(caplog):
    checkv.check_equal(0, 10)

    for record in caplog.records:
        assert record.levelname == "ERROR"
    assert "Equality check failed - Got abs (0 - 10) > 0." in caplog.text
예제 #5
0
def test_check_equal_int_0_1_pass(caplog):
    checkv.check_equal(0, 1, max_diff=1)

    for record in caplog.records:
        assert record.levelname == "INFO"
    assert "Equality check passed - Got abs (0 - 1) <= 1." in caplog.text
예제 #6
0
def test_check_equal_int_1_1_pass(caplog):
    checkv.check_equal(1, 1)

    for record in caplog.records:
        assert record.levelname == "INFO"
    assert "Equality check passed - Got abs (1 - 1) <= 0." in caplog.text
예제 #7
0
def test_check_equal_real_my_checker__0_1_fail2(caplog):
    checkv.check_equal(0.0, 1.0, max_diff=0.9, checker=my_checker)

    for record in caplog.records:
        assert record.levelname == "ERROR"
    assert "Equality check failed - Got abs (0.0 - 1.0) > 0.9." in caplog.text
예제 #8
0
def test_check_equal_real_my_checker__0_0_pass(caplog):
    checkv.check_equal(0.0, 0.0, checker=my_checker)

    for record in caplog.records:
        assert record.levelname == "INFO"
    assert "Equality check passed - Got abs (0.0 - 0.0) <= 0.0." in caplog.text
예제 #9
0
def test_check_equal_real_0_1_pass(caplog):
    checkv.check_equal(0.0, 1.0, max_diff=1.0)

    for record in caplog.records:
        assert record.levelname == "INFO"
    assert "Equality check passed - Got abs (0.0 - 1.0) <= 1.0." in caplog.text