52
52
DUMMY_EXTRA_LARGE_FILE_NAME ,
53
53
DUMMY_MODEL_ID ,
54
54
DUMMY_MODEL_ID_REVISION_ONE_SPECIFIC_COMMIT ,
55
- DUMMY_RENAMED_NEW_MODEL_ID ,
56
55
DUMMY_RENAMED_OLD_MODEL_ID ,
57
56
DUMMY_TINY_FILE_NAME ,
58
57
SAMPLE_DATASET_IDENTIFIER ,
@@ -318,7 +317,7 @@ def _check_user_agent(headers: dict):
318
317
user_agent = "foo/bar" ,
319
318
)
320
319
calls = mock_request .call_args_list
321
- assert len (calls ) == 3 # HEAD, HEAD, GET
320
+ assert len (calls ) >= 3 # at least HEAD, HEAD, GET
322
321
for call in calls :
323
322
_check_user_agent (call .kwargs ["headers" ])
324
323
@@ -333,7 +332,7 @@ def _check_user_agent(headers: dict):
333
332
user_agent = "foo/bar" ,
334
333
)
335
334
calls = mock_request .call_args_list
336
- assert len (calls ) == 2 # HEAD, HEAD
335
+ assert len (calls ) >= 2 # at least HEAD, HEAD
337
336
for call in calls :
338
337
_check_user_agent (call .kwargs ["headers" ])
339
338
@@ -482,24 +481,8 @@ def test_get_hf_file_metadata_basic(self) -> None:
482
481
# Metadata
483
482
self .assertEqual (metadata .commit_hash , DUMMY_MODEL_ID_REVISION_ONE_SPECIFIC_COMMIT )
484
483
self .assertIsNotNone (metadata .etag ) # example: "85c2fc2dcdd86563aaa85ef4911..."
485
- self .assertEqual (metadata .location , url ) # no redirect
486
484
self .assertEqual (metadata .size , 851 )
487
485
488
- def test_get_hf_file_metadata_from_a_renamed_repo (self ) -> None :
489
- """Test getting metadata from a file in a renamed repo on the Hub."""
490
- url = hf_hub_url (
491
- DUMMY_RENAMED_OLD_MODEL_ID ,
492
- filename = constants .CONFIG_NAME ,
493
- subfolder = "" , # Subfolder should be processed as `None`
494
- )
495
- metadata = get_hf_file_metadata (url )
496
-
497
- # Got redirected to renamed repo
498
- self .assertEqual (
499
- metadata .location ,
500
- url .replace (DUMMY_RENAMED_OLD_MODEL_ID , DUMMY_RENAMED_NEW_MODEL_ID ),
501
- )
502
-
503
486
def test_get_hf_file_metadata_from_a_lfs_file (self ) -> None :
504
487
"""Test getting metadata from an LFS file.
505
488
0 commit comments