![]() |
The Gaudi Framework
master (cc9a61f4)
|
Classes | |
| class | CodeWrapper |
Functions | |
| platform_matches (List[str] unsupported_platforms) | |
| str_representer (dumper, data) | |
| kill_tree (ppid, sig) | |
| which (executable) | |
| get_platform () | |
| expand_reference_file_name (reference) | |
| Dict[str, Any] | filter_dict (Dict[str, Any] d, re.Pattern ignore_re) |
| str | compare_dicts (Dict[str, Any] d1, Dict[str, Any] d2, str ignore_re=None) |
| _parse_ttree_summary (lines, pos) | |
| _parse_histos_summary (lines, pos) | |
| find_histos_summaries (stdout) | |
| find_ttree_summaries (stdout) | |
| file_path_for_class (cls) | |
| str | _format_path (List[str] path) |
| bool | _floats_close (float a, float b, float rtol, float atol) |
| None | _compare (Any obj1, Any obj2, List[str] path, float rtol, float atol, int max_differences, List[str] differences) |
| None | assert_objects_equal (Any obj1, Any obj2, float rtol=1e-9, float atol=0.0, int max_differences=10) |
Variables | |
| h_count_re | |
|
protected |
Recursively compare two objects and append difference descriptions to the list. Handles dicts, lists, floats (with tolerance), and other types (exact equality). Stops early if max_differences is reached.
Definition at line 424 of file utils.py.
|
protected |
Check if two floats are close within relative and absolute tolerance.
Definition at line 412 of file utils.py.
|
protected |
Format a path list as a bracket-notation string for error messages.
Definition at line 405 of file utils.py.
|
protected |
Extract the histograms infos from the lines starting at pos. Returns the position of the first line after the summary block.
Definition at line 288 of file utils.py.
|
protected |
Parse the TTree summary table in lines, starting from pos. Returns a tuple with the dictionary with the digested informations and the position of the first line after the summary.
Definition at line 207 of file utils.py.
| None GaudiTesting.utils.assert_objects_equal | ( | Any | obj1, |
| Any | obj2, | ||
| float | rtol = 1e-9, | ||
| float | atol = 0.0, | ||
| int | max_differences = 10 ) |
Assert that two JSON-like objects are equal, with tolerance for floating-point values.
Args:
obj1: First object to compare (can be dict, list, or primitive types)
obj2: Second object to compare
rtol: Relative tolerance for float comparisons (default: 1e-9)
atol: Absolute tolerance for float comparisons (default: 0.0)
max_differences: Maximum number of differences to report before stopping (default: 10)
Raises:
AssertionError: If the objects are not equal, with a detailed message
showing differences found (up to max_differences).
Example:
>>> assert_objects_equal({"a": 1.0}, {"a": 1.0}) # passes
>>> assert_objects_equal({"a": 1.0}, {"a": 1.001}, atol=0.01) # passes
>>> assert_objects_equal({"a": 1}, {"a": 2}) # raises AssertionError
Definition at line 496 of file utils.py.
| str GaudiTesting.utils.compare_dicts | ( | Dict[str, Any] | d1, |
| Dict[str, Any] | d2, | ||
| str | ignore_re = None ) |
Compare two dictionaries and return the diff as a string, ignoring keys that match the regex.
Definition at line 185 of file utils.py.
| GaudiTesting.utils.expand_reference_file_name | ( | reference | ) |
Definition at line 119 of file utils.py.
| GaudiTesting.utils.file_path_for_class | ( | cls | ) |
| Dict[str, Any] GaudiTesting.utils.filter_dict | ( | Dict[str, Any] | d, |
| re.Pattern | ignore_re ) |
Recursively filter out keys from the dictionary that match the ignore pattern.
Definition at line 171 of file utils.py.
| GaudiTesting.utils.find_histos_summaries | ( | stdout | ) |
Scan stdout to find ROOT Histogram summaries and digest them.
Definition at line 356 of file utils.py.
| GaudiTesting.utils.find_ttree_summaries | ( | stdout | ) |
Scan stdout to find ROOT TTree summaries and digest them.
Definition at line 379 of file utils.py.
| GaudiTesting.utils.get_platform | ( | ) |
Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.
Definition at line 91 of file utils.py.
| GaudiTesting.utils.kill_tree | ( | ppid, | |
| sig ) |
Send a signal to a process and all its child processes (starting from the leaves).
Definition at line 44 of file utils.py.
| GaudiTesting.utils.platform_matches | ( | List[str] | unsupported_platforms | ) |
| GaudiTesting.utils.str_representer | ( | dumper, | |
| data ) |
| GaudiTesting.utils.which | ( | executable | ) |
Locates an executable in the executables path ($PATH) and returns the full path to it. An application is looked for with or without the '.exe' suffix. If the executable cannot be found, None is returned
Definition at line 67 of file utils.py.