Esempio n. 1
0
def test_convert_to_number_leaves_other_things__unchanged():
    for value in [0, 'other', True, 123]:
        assert convert_to_number(value) == value
Esempio n. 2
0
def test_convert_to_number_can_remove_prefixes(text, prefix, number):
    assert convert_to_number(text, prefix=prefix) == number
Esempio n. 3
0
def test_convert_to_number_can_remove_suffixes(text, suffix, number):
    assert convert_to_number(text, suffix=suffix) == number
Esempio n. 4
0
def test_convert_to_number_converts_floaty_looking_strings_into_floats():
    for number in ['0.99', '1.1', '1000.0000001']:
        assert isinstance(convert_to_number(number), float)
Esempio n. 5
0
def test_convert_to_number_converts_integer_looking_strings_into_floats():
    for number in ['0', '1', '2', '9999']:
        assert isinstance(convert_to_number(number), int)
def test_convert_to_number_leaves_other_things__unchanged():
    for value in [0, 'other', True, 123]:
        assert convert_to_number(value) == value
def test_convert_to_number_converts_floaty_looking_strings_into_floats():
    for number in ['0.99', '1.1', '1000.0000001']:
        assert isinstance(convert_to_number(number), float)
def test_convert_to_number_converts_integer_looking_strings_into_floats():
    for number in ['0', '1', '2', '9999']:
        assert isinstance(convert_to_number(number), int)