File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33from unittest import mock
44
55import keras
6+ from huggingface_hub .utils import EntryNotFoundError
7+ from kagglehub .exceptions import KaggleApiHTTPError
68import pytest
79from absl .testing import parameterized
810
@@ -204,8 +206,6 @@ def test_get_file_raises_file_not_found(self):
204206 get_file (local_dir , fake_path )
205207
206208 def test_kaggle_error_translation (self ):
207- from kagglehub .exceptions import KaggleApiHTTPError
208-
209209 preset = "kaggle://keras/bert/keras/bert_base_en"
210210 # Kaggle serves a missing file as a 404 and a gated file as a 403;
211211 # both translate to FileNotFoundError (check_file_exists relies on
@@ -223,8 +223,6 @@ def test_kaggle_error_translation(self):
223223 get_file (preset , "vocabulary.json" )
224224
225225 def test_hf_missing_entry_translation (self ):
226- from huggingface_hub .utils import EntryNotFoundError
227-
228226 error = EntryNotFoundError ("404 Client Error" )
229227 with mock .patch ("huggingface_hub.hf_hub_download" , side_effect = error ):
230228 with self .assertRaises (FileNotFoundError ):
You can’t perform that action at this time.
0 commit comments