Spaces:
Sleeping
Sleeping
| """Tests for Hugging Face deployment helper behavior.""" | |
| from __future__ import annotations | |
| import os | |
| import unittest | |
| from unittest.mock import patch | |
| from scripts import deploy_space | |
| class DeployHelperTests(unittest.TestCase): | |
| """Validate deploy helper defaults without contacting Hugging Face.""" | |
| def test_ignore_patterns_are_list_for_huggingface_hub(self) -> None: | |
| ignore_patterns = deploy_space.get_ignore_patterns() | |
| self.assertIsInstance(ignore_patterns, list) | |
| self.assertIn("models/**/*.safetensors", ignore_patterns) | |
| self.assertIsInstance(deploy_space.IGNORE_PATTERNS, list) | |
| self.assertIn("models/**/*.safetensors", deploy_space.IGNORE_PATTERNS) | |
| def test_missing_token_returns_empty_string(self) -> None: | |
| with patch.dict(os.environ, {}, clear=True): | |
| self.assertEqual(deploy_space.get_hf_token(), "") | |
| def test_space_id_defaults_to_myco_space(self) -> None: | |
| with patch.dict(os.environ, {}, clear=True): | |
| self.assertEqual(deploy_space.get_space_id(), "byte-vortex/Myco") | |
| if __name__ == "__main__": | |
| unittest.main() | |