File size: 1,127 Bytes
231d560
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""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()