@@ -222,3 +222,30 @@ def test_given_invalid_date_str_to_datetime_raises_value_error():
222222 str_to_datetime_fn = macros ["str_to_datetime" ]
223223 with pytest .raises (ValueError ):
224224 str_to_datetime_fn ("invalid-date" )
225+
226+
227+ @pytest .mark .parametrize (
228+ "test_name, input_value, expected_output" ,
229+ [
230+ (
231+ "test_basic_url" ,
232+ "https://example.com/path?query=value" ,
233+ "https%3A%2F%2Fexample.com%2Fpath%3Fquery%3Dvalue" ,
234+ ),
235+ (
236+ "test_url_with_spaces" ,
237+ "https://example.com/path with spaces?query=some value" ,
238+ "https%3A%2F%2Fexample.com%2Fpath+with+spaces%3Fquery%3Dsome+value" ,
239+ ),
240+ (
241+ "test_url_with_special_chars" ,
242+ "https://example.com/path?query=value&other=123+456#fragment" ,
243+ "https%3A%2F%2Fexample.com%2Fpath%3Fquery%3Dvalue%26other%3D123%2B456%23fragment" ,
244+ ),
245+ ("test_non_url_string" , "hello world" , "hello+world" ),
246+ ],
247+ )
248+ def test_sanitize_url (test_name , input_value , expected_output ):
249+ sanitize_url = macros ["sanitize_url" ]
250+ actual_output = sanitize_url (input_value )
251+ assert actual_output == expected_output
0 commit comments