Download tests/test_data_error_visibility.py from smlflg/CodexDashBoard: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/smlflg/CodexDashBoard/resolve/main/tests/test_data_error_visibility.py
- Command line
-
hf download hf://smlflg/CodexDashBoard/tests/test_data_error_visibility.py
-
curl -L -o test_data_error_visibility.py https://huggingface.co/smlflg/CodexDashBoard/resolve/main/tests/test_data_error_visibility.py
1.26 kB
| from pathlib import Path | |
| import ast | |
| PROJECT_ROOT = Path(__file__).resolve().parents[1] | |
| APP_PY = PROJECT_ROOT / "src" / "codex_dashboard" / "app.py" | |
| def _method_source(class_name: str, method_name: str) -> str: | |
| source = APP_PY.read_text(encoding="utf-8") | |
| tree = ast.parse(source) | |
| for node in ast.walk(tree): | |
| if isinstance(node, ast.ClassDef) and node.name == class_name: | |
| for item in node.body: | |
| if isinstance(item, ast.FunctionDef) and item.name == method_name: | |
| return ast.get_source_segment(source, item) or "" | |
| raise AssertionError(f"missing {class_name}.{method_name}") | |
| def test_session_refresh_status_distinguishes_database_error_from_no_sessions(): | |
| source = _method_source("CodexDashboard", "refresh_sessions") | |
| assert "list_threads_result" in source | |
| assert ".error" in source | |
| assert "Session database error" in source | |
| assert "No Codex sessions found" not in source | |
| def test_log_refresh_status_distinguishes_database_error_from_no_logs(): | |
| source = _method_source("CodexDashboard", "refresh_logs") | |
| assert "list_logs_result" in source | |
| assert ".error" in source | |
| assert "Log database error" in source | |
| assert "No Codex logs found" not in source | |