|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| str | _read (str rel_path) |
| test_module_is_a_nonempty_list_within_the_stated_range () | |
| test_no_duplicate_name_where_pairs () | |
| test_entry_schema (i, entry) | |
| test_entry_file_exists (i, entry) | |
| test_entry_symbol_appears_in_file (i, entry) | |
| test_categories_are_all_represented () | |
| test_this_test_actually_catches_a_broken_entry () | |
Variables | |
| REPO_ROOT = Path(__file__).resolve().parents[1] | |
| dict | _CATEGORIES |
| dict | _REQUIRED_KEYS = {"name", "value", "where", "meaning", "category", "affects_results"} |
| dict | _FILE_CACHE = {} |
CODE_CONSTANTS is the register behind the Parameters workspace's "In code" section (``GET /api/config/parameters`` -> ``backend/routers/config.py`` -> ``ConstantsTable`` in ``frontend/src/components/ParametersWorkspace.tsx``). Every entry claims a specific file and a specific symbol in it; this test is the only thing that checks the claim is still true, since nothing else re-reads this module against the source it describes.
|
protected |
Definition at line 38 of file test_code_constants.py.
Referenced by test_entry_symbol_appears_in_file(), and test_this_test_actually_catches_a_broken_entry().
| test_code_constants.test_categories_are_all_represented | ( | ) |
Every category the frontend can filter by should have at least one entry, or the filter silently shows nothing -- a smell that a whole area of code was never surveyed.
Definition at line 126 of file test_code_constants.py.
| test_code_constants.test_entry_file_exists | ( | i, | |
| entry ) |
Definition at line 97 of file test_code_constants.py.
References split().
| test_code_constants.test_entry_schema | ( | i, | |
| entry ) |
Every entry has exactly the required keys, with the right types and constraints.
Definition at line 64 of file test_code_constants.py.
| test_code_constants.test_entry_symbol_appears_in_file | ( | i, | |
| entry ) |
The claimed symbol must actually appear in the claimed file, as a whole identifier. ``where`` may name a dotted path like ``ClassName.method_name`` or a bracketed dict access like ``TABLE['key']``; we check the last bare identifier component, since that is the part a reader would actually search for, and it is robust to the class/function/constant living on different lines than any wrapping name.
Definition at line 104 of file test_code_constants.py.
| test_code_constants.test_module_is_a_nonempty_list_within_the_stated_range | ( | ) |
Definition at line 44 of file test_code_constants.py.
| test_code_constants.test_no_duplicate_name_where_pairs | ( | ) |
Definition at line 52 of file test_code_constants.py.
| test_code_constants.test_this_test_actually_catches_a_broken_entry | ( | ) |
A test that cannot fail is not a test (CLAUDE.md). Prove the file/symbol checks above are live by running them against entries engineered to be wrong, using the exact same logic.
Definition at line 134 of file test_code_constants.py.
|
protected |
Definition at line 19 of file test_code_constants.py.
|
protected |
Definition at line 35 of file test_code_constants.py.
|
protected |
Definition at line 32 of file test_code_constants.py.
| test_code_constants.REPO_ROOT = Path(__file__).resolve().parents[1] |
Definition at line 17 of file test_code_constants.py.