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_can_remove_prefixes(text, prefix, number): assert convert_to_number(text, prefix=prefix) == number
def test_convert_to_number_can_remove_suffixes(text, suffix, number): assert convert_to_number(text, suffix=suffix) == number
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)