@@ -37,17 +37,26 @@ def test_normalize_path(sync_client: SyncClient):
3737 """Test path normalization functionality."""
3838 # GIVEN various file paths with different formats
3939 test_cases = [
40- ("path/to/file.prompt" , "path/to/file" ),
41- ("path\\ to\\ file.agent" , "path/to/file" ),
42- ("trailing/slashes/file.agent/" , "trailing/slashes/file" ),
43- ("multiple//slashes//file.prompt" , "multiple/slashes/file" ),
40+ # Input path, expected with strip_extension=False, expected with strip_extension=True
41+ ("path/to/file.prompt" , "path/to/file.prompt" , "path/to/file" ),
42+ ("path\\ to\\ file.agent" , "path/to/file.agent" , "path/to/file" ),
43+ ("trailing/slashes/file.agent/" , "trailing/slashes/file.agent" , "trailing/slashes/file" ),
44+ ("multiple//slashes//file.prompt" , "multiple/slashes/file.prompt" , "multiple/slashes/file" ),
4445 ]
4546
46- for input_path , expected in test_cases :
47- # WHEN they are normalized
48- normalized = sync_client ._normalize_path (input_path )
49- # THEN they should be converted to the expected format
50- assert normalized == expected
47+ # Test with strip_extension=False (default)
48+ for input_path , expected_with_ext , _ in test_cases :
49+ # WHEN they are normalized without stripping extension
50+ normalized = sync_client ._normalize_path (input_path , strip_extension = False )
51+ # THEN they should be converted to the expected format with extension
52+ assert normalized == expected_with_ext
53+
54+ # Test with strip_extension=True
55+ for input_path , _ , expected_without_ext in test_cases :
56+ # WHEN they are normalized with extension stripping
57+ normalized = sync_client ._normalize_path (input_path , strip_extension = True )
58+ # THEN they should be converted to the expected format without extension
59+ assert normalized == expected_without_ext
5160
5261 # Test absolute path raises error
5362 with pytest .raises (HumanloopRuntimeError , match = "Absolute paths are not supported" ):
0 commit comments