"""Test routing_converters.""" from product import routing_converters def test_comma_separated_int_to_python(): """Test CommaSeparatedInt.to_python with valid values.""" comma_converter = routing_converters.CommaSeparatedInt({}) assert comma_converter.to_python('1,2,3') == [1, 2, 3] def test_comma_separated_int_to_python_invalid(): """Test CommaSeparatedInt.to_python with invalid values.""" comma_converter = routing_converters.CommaSeparatedInt({}) assert comma_converter.to_python('1,a,3.5') == [] assert comma_converter.to_python('1,2,3.5') == [] assert comma_converter.to_python('') == [] def test_comma_separated_int_to_url(): """Test CommaSeparatedInt.to_url.""" comma_converter = routing_converters.CommaSeparatedInt({}) assert comma_converter.to_url([1, 2, 3]) == '1,2,3' assert comma_converter.to_url([]) == ''