Skip to content

Commit

Permalink
Update tokenizer test.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamanehSaadat committed Apr 22, 2024
1 parent 2a3aca2 commit 33524af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion keras_nlp/models/preprocessor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_save_to_preset(self, cls, preset_name, tokenizer_type):
vocab_filename = "vocabulary.txt"
expected_assets = ["vocabulary.txt"]

# Check existence of files.
# Check existence of vocab file.
vocab_path = os.path.join(
save_dir, os.path.join(TOKENIZER_ASSET_DIR, vocab_filename)
)
Expand Down
12 changes: 4 additions & 8 deletions keras_nlp/tokenizers/tokenizer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from keras_nlp.utils.preset_utils import TOKENIZER_ASSET_DIR
from keras_nlp.utils.preset_utils import TOKENIZER_CONFIG_FILE
from keras_nlp.utils.preset_utils import check_config_class
from keras_nlp.utils.preset_utils import get_file


class SimpleTokenizer(Tokenizer):
Expand Down Expand Up @@ -113,14 +112,11 @@ def test_save_to_preset(self, cls, preset_name, tokenizer_type):
vocab_filename = "vocabulary.txt"
expected_assets = ["vocabulary.txt"]

# Check existence of files.
self.assertTrue(
os.path.exists(
get_file(
save_dir, os.path.join(TOKENIZER_ASSET_DIR, vocab_filename)
)
)
# Check existence of vocab file.
vocab_path = os.path.join(
save_dir, os.path.join(TOKENIZER_ASSET_DIR, vocab_filename)
)
self.assertTrue(os.path.exists(vocab_path))

# Check assets.
self.assertEqual(set(tokenizer.file_assets), set(expected_assets))
Expand Down

0 comments on commit 33524af

Please sign in to comment.