Update SnapForm to version 0.10.10 and add technical documentation
- Bump SnapForm version in uv.lock from 0.9.30 to 0.10.10. - Introduce comprehensive technical documentation for SnapForm, detailing features, usage instructions, and development guidelines.
This commit is contained in:
@@ -143,49 +143,29 @@ class DownloadProgressTest(unittest.TestCase):
|
||||
|
||||
self.assertFalse(status_path.exists())
|
||||
|
||||
def test_resolve_hf_endpoint_keeps_direct_endpoint(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": ""}), patch.object(
|
||||
self.worker,
|
||||
"reachable",
|
||||
return_value=True,
|
||||
):
|
||||
endpoint, used_mirror = self.worker.resolve_hf_endpoint()
|
||||
def test_download_endpoints_keeps_direct_endpoint(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": ""}):
|
||||
endpoints = self.worker.download_endpoints()
|
||||
|
||||
self.assertEqual(endpoint, "https://huggingface.co/")
|
||||
self.assertFalse(used_mirror)
|
||||
self.assertEqual(
|
||||
endpoints,
|
||||
["https://huggingface.co"],
|
||||
)
|
||||
|
||||
def test_resolve_hf_endpoint_falls_back_to_mirror(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": ""}), patch.object(
|
||||
self.worker,
|
||||
"reachable",
|
||||
side_effect=lambda url, timeout=None: "hf-mirror" in url,
|
||||
):
|
||||
endpoint, used_mirror = self.worker.resolve_hf_endpoint()
|
||||
def test_download_endpoints_respects_environment_override(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": "https://hf.example"}):
|
||||
endpoints = self.worker.download_endpoints()
|
||||
|
||||
self.assertEqual(endpoint, "https://hf-mirror.com")
|
||||
self.assertTrue(used_mirror)
|
||||
self.assertEqual(
|
||||
endpoints,
|
||||
["https://hf.example"],
|
||||
)
|
||||
|
||||
def test_resolve_hf_endpoint_respects_environment_override(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": "https://hf.example"}), patch.object(
|
||||
self.worker,
|
||||
"reachable",
|
||||
) as mocked_reachable:
|
||||
endpoint, used_mirror = self.worker.resolve_hf_endpoint()
|
||||
def test_download_endpoints_strips_trailing_slash(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": "https://hf.example/"}):
|
||||
endpoints = self.worker.download_endpoints()
|
||||
|
||||
self.assertEqual(endpoint, "https://hf.example")
|
||||
self.assertFalse(used_mirror)
|
||||
mocked_reachable.assert_not_called()
|
||||
|
||||
def test_resolve_hf_endpoint_keeps_direct_when_mirrors_unreachable(self):
|
||||
with patch.dict(os.environ, {"HF_ENDPOINT": ""}), patch.object(
|
||||
self.worker,
|
||||
"reachable",
|
||||
return_value=False,
|
||||
):
|
||||
endpoint, used_mirror = self.worker.resolve_hf_endpoint()
|
||||
|
||||
self.assertEqual(endpoint, "https://huggingface.co/")
|
||||
self.assertFalse(used_mirror)
|
||||
self.assertEqual(endpoints, ["https://hf.example"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user