Download tests/test_da3_compat.py from junaid-simamdigital/Simam3DZeroGPU: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/junaid-simamdigital/Simam3DZeroGPU/resolve/main/tests/test_da3_compat.py
- Command line
-
hf download hf://spaces/junaid-simamdigital/Simam3DZeroGPU/tests/test_da3_compat.py
-
curl -L -o test_da3_compat.py https://huggingface.co/spaces/junaid-simamdigital/Simam3DZeroGPU/resolve/main/tests/test_da3_compat.py
1.24 kB
| from types import SimpleNamespace | |
| from da3_compat import resolve_da3_class | |
| def test_da3_resolver_prefers_api_module(): | |
| marker = object() | |
| modules = {"depth_anything_3.api": SimpleNamespace(DepthAnything3=marker)} | |
| def importer(location): | |
| if location not in modules: | |
| raise ModuleNotFoundError(location) | |
| return modules[location] | |
| cls, location = resolve_da3_class(importer) | |
| assert cls is marker | |
| assert location == "depth_anything_3.api" | |
| def test_da3_resolver_supports_package_root_and_reports_failures(): | |
| marker = object() | |
| modules = {"depth_anything_3": SimpleNamespace(DepthAnything3=marker)} | |
| def importer(location): | |
| if location not in modules: | |
| raise ModuleNotFoundError(location) | |
| return modules[location] | |
| cls, location = resolve_da3_class(importer) | |
| assert cls is marker | |
| assert location == "depth_anything_3" | |
| try: | |
| resolve_da3_class(lambda location: (_ for _ in ()).throw(ModuleNotFoundError(location))) | |
| except ImportError as exc: | |
| assert "depth_anything_3.api" in str(exc) | |
| assert "depth_anything_3" in str(exc) | |
| else: | |
| raise AssertionError("missing DA3 modules should raise ImportError") | |