コード例 #1
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_exception_message_contains_correct_info():
    msg = "dummy"
    str_val = "abcde"
    with pytest.raises(SchemaError) as exc_info:
        validate_int_option(str_val, msg)

    check_exception_message(exc_info, msg, str_val)
コード例 #2
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_exception_message_contains_correct_info():
    msg = "dummy"
    str_val = "abcde"
    with pytest.raises(SchemaError) as exc_info:
        validate_int_option(str_val, msg)

    check_exception_message(exc_info, msg, str_val)
コード例 #3
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_returns_correct_value():
    int_val = 1
    assert validate_int_option(str(int_val), "dummy") == int_val
コード例 #4
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_float_option_does_not_raise_exception_for_negative_if_min_val_not_specified(
):
    validate_int_option(-1.23, "dummy")
コード例 #5
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_float_option_raises_exception_for_negative_if_min_val_specified(
):
    with pytest.raises(SchemaError):
        validate_int_option(-1.23, "dummy", min_val=0)
コード例 #6
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_does_not_raise_exception_for_none_if_nullable_specified(
):
    validate_int_option(None, "dummy", nullable=True)
コード例 #7
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_raises_exception_for_none_if_nullable_not_specified(
):
    with pytest.raises(SchemaError):
        validate_int_option(None, "dummy")
コード例 #8
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_raises_exception_for_non_int():
    with pytest.raises(SchemaError):
        validate_int_option("a", "dummy")
コード例 #9
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_returns_correct_value():
    int_val = 1
    assert validate_int_option(str(int_val), "dummy") == int_val
コード例 #10
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_float_option_does_not_raise_exception_for_negative_if_min_val_not_specified():
    validate_int_option(-1.23, "dummy")
コード例 #11
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_float_option_raises_exception_for_negative_if_min_val_specified():
    with pytest.raises(SchemaError):
        validate_int_option(-1.23, "dummy", min_val=0)
コード例 #12
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_does_not_raise_exception_for_none_if_nullable_specified():
    validate_int_option(None, "dummy", nullable=True)
コード例 #13
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_raises_exception_for_none_if_nullable_not_specified():
    with pytest.raises(SchemaError):
        validate_int_option(None, "dummy")
コード例 #14
0
ファイル: test_options.py プロジェクト: lweasel/piquant
def test_validate_int_option_raises_exception_for_non_int():
    with pytest.raises(SchemaError):
        validate_int_option("a", "dummy")
コード例 #15
0
ファイル: test_options.py プロジェクト: COMBINE-lab/piquant
def test_validate_int_option_does_not_raise_exception_for_negative_if_nonneg_not_specified():
    validate_int_option(-1, "dummy")
コード例 #16
0
ファイル: test_options.py プロジェクト: COMBINE-lab/piquant
def test_validate_int_option_raises_exception_for_negative_if_nonneg_specified():
    with pytest.raises(SchemaError):
        validate_int_option(-1, "dummy", nonneg=True)