@@ -28,7 +28,7 @@ def test_init(sync_client: SyncClient, tmp_path: Path):
2828 # THEN it should be initialized with correct base directory, cache size and file types
2929 assert sync_client .base_dir == tmp_path
3030 assert sync_client ._cache_size == 10
31- assert sync_client .SERIALIZABLE_FILE_TYPES == ["prompt" , "agent" ]
31+ assert sync_client .SERIALIZABLE_FILE_TYPES == frozenset ( ["prompt" , "agent" ])
3232
3333
3434def test_normalize_path (sync_client : SyncClient ):
@@ -37,7 +37,6 @@ def test_normalize_path(sync_client: SyncClient):
3737 test_cases = [
3838 ("path/to/file.prompt" , "path/to/file" ),
3939 ("path\\ to\\ file.agent" , "path/to/file" ),
40- ("/leading/slashes/file.prompt" , "leading/slashes/file" ),
4140 ("trailing/slashes/file.agent/" , "trailing/slashes/file" ),
4241 ("multiple//slashes//file.prompt" , "multiple/slashes/file" ),
4342 ]
@@ -48,6 +47,10 @@ def test_normalize_path(sync_client: SyncClient):
4847 # THEN they should be converted to the expected format
4948 assert normalized == expected
5049
50+ # Test absolute path raises error
51+ with pytest .raises (HumanloopRuntimeError , match = "Absolute paths are not supported" ):
52+ sync_client ._normalize_path ("/leading/slashes/file.prompt" )
53+
5154
5255def test_is_file (sync_client : SyncClient ):
5356 """Test file type detection."""
@@ -65,7 +68,7 @@ def test_save_and_read_file(sync_client: SyncClient):
6568 # GIVEN a file content and path
6669 content = "test content"
6770 path = "test/path"
68- file_type : SerializableFileType = "prompt"
71+ file_type : SerializableFileType = "prompt"
6972
7073 # WHEN saving the file
7174 sync_client ._save_serialized_file (content , path , "prompt" )
@@ -90,12 +93,6 @@ def test_error_handling(sync_client: SyncClient):
9093 with pytest .raises (HumanloopRuntimeError , match = "Local file not found" ):
9194 sync_client .get_file_content ("nonexistent" , "prompt" )
9295
93- # GIVEN an invalid file type
94- # WHEN trying to pull the file
95- # THEN a ValueError should be raised
96- with pytest .raises (ValueError , match = "Unsupported file type" ):
97- sync_client ._pull_file ("test.txt" )
98-
9996 # GIVEN an API error
10097 # WHEN trying to pull a file
10198 # THEN it should return False
0 commit comments