Skip to content

Commit

Permalink
Tweak old huggingface hub tests
Browse files Browse the repository at this point in the history
  • Loading branch information
desilinguist committed Feb 12, 2024
1 parent 85c9f9c commit 3bdd3e7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/common/file_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,11 @@ def test_snapshot_download(self):
def test_cached_download_no_user_or_org(self):
path = cached_path("hf://t5-small/config.json", cache_dir=self.TEST_DIR)
assert os.path.isfile(path)
assert pathlib.Path(os.path.dirname(path)) == self.TEST_DIR
assert os.path.isfile(path + ".json")
meta = _Meta.from_path(path + ".json")
assert meta.etag is not None
assert meta.resource == "hf://t5-small/config.json"
assert self.TEST_DIR in pathlib.Path(path).parents

def test_snapshot_download_no_user_or_org(self):
# This is the smallest snapshot I could find that is not associated with a user / org.
model_name = "distilbert-base-german-cased"
path = cached_path(f"hf://{model_name}")
path = cached_path(f"hf://{model_name}", cache_dir=self.TEST_DIR)
assert os.path.isdir(path)
assert os.path.isfile(path + ".json")
meta = _Meta.from_path(path + ".json")
assert meta.resource == f"hf://{model_name}"
assert self.TEST_DIR in pathlib.Path(path).parents

0 comments on commit 3bdd3e7

Please sign in to comment.