Spaces:
Running
Running
Download backend/SQL_Agent/tests/test_tenant_file_toolkit_structured.py from ranilmukesh/sirus: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/ranilmukesh/sirus/resolve/main/backend/SQL_Agent/tests/test_tenant_file_toolkit_structured.py
- Command line
-
hf download hf://spaces/ranilmukesh/sirus/backend/SQL_Agent/tests/test_tenant_file_toolkit_structured.py
-
curl -L -o test_tenant_file_toolkit_structured.py https://huggingface.co/spaces/ranilmukesh/sirus/resolve/main/backend/SQL_Agent/tests/test_tenant_file_toolkit_structured.py
1.46 kB
| from types import SimpleNamespace | |
| from backend.SQL_Agent.tenant_file_toolkit import TenantFileToolkit | |
| class _MockStorage: | |
| bucket_name = "ml-bucket" | |
| class _Client: | |
| def list_objects(bucket, prefix=None, recursive=True): | |
| return [ | |
| SimpleNamespace(object_name="tenant_1/files/raw_data.csv", size=1024, last_modified=SimpleNamespace(strftime=lambda _f: "2026-01-01 00:00:00")), | |
| SimpleNamespace(object_name="tenant_1/projects/p1/models/model_v1.joblib", size=2048, last_modified=SimpleNamespace(strftime=lambda _f: "2026-01-01 00:00:00")), | |
| SimpleNamespace(object_name="tenant_1/projects/p1/evaluation/report_v1.md", size=1000, last_modified=SimpleNamespace(strftime=lambda _f: "2026-01-01 00:00:00")), | |
| ] | |
| client = _Client() | |
| def test_list_tenant_assets_structured_groups_datasets_models_reports(): | |
| toolkit = TenantFileToolkit(storage_service=_MockStorage()) | |
| class _RunContext: | |
| session_state = {"tenant_id": "tenant_1"} | |
| result = toolkit.list_tenant_assets_structured(run_context=_RunContext()) | |
| assert "datasets" in result | |
| assert "models" in result | |
| assert "reports" in result | |
| assert any(item["path"].endswith("raw_data.csv") for item in result["datasets"]) | |
| assert any(item["path"].endswith(".joblib") for item in result["models"]) | |
| assert any(item["path"].endswith(".md") for item in result["reports"]) | |