Esempio n. 1
0
def test_validate_from_sequence():
    argument = ['a', 'b', 'c']
    expected = ManualStringEncoding(array=argument)

    actual = validate_string_encoding(argument)

    assert actual == expected
Esempio n. 2
0
def test_validate_from_non_format_string():
    argument = 'abc'
    expected = ConstantStringEncoding(constant=argument)

    actual = validate_string_encoding(argument)

    assert actual == expected
Esempio n. 3
0
def test_validate_from_format_string():
    argument = '{class}: {score:.2f}'
    expected = FormatStringEncoding(format=argument)

    actual = validate_string_encoding(argument)

    assert actual == expected
Esempio n. 4
0
def test_validate_from_format_dict():
    format = '{class}: {score:.2f}'
    argument = {'format': format}
    expected = FormatStringEncoding(format=format)

    actual = validate_string_encoding(argument)

    assert actual == expected
Esempio n. 5
0
def test_validate_from_direct_dict():
    feature = 'class'
    argument = {'feature': feature}
    expected = DirectStringEncoding(feature=feature)

    actual = validate_string_encoding(argument)

    assert actual == expected
Esempio n. 6
0
def test_validate_from_constant_dict():
    constant = 'test'
    argument = {'constant': constant}
    expected = ConstantStringEncoding(constant=constant)

    actual = validate_string_encoding(argument)

    assert actual == expected
Esempio n. 7
0
def test_validate_from_manual_dict():
    array = ['a', 'b', 'c']
    default = 'd'
    argument = {'array': array, 'default': default}
    expected = ManualStringEncoding(array=array, default=default)

    actual = validate_string_encoding(argument)

    assert actual == expected