(a, b, tol=0, comp_extras_as_str=False)
| 971 | |
| 972 | |
| 973 | def _assert_annotations_equal(a, b, tol=0, comp_extras_as_str=False): |
| 974 | __tracebackhide__ = True |
| 975 | assert_allclose(a.onset, b.onset, rtol=0, atol=tol, err_msg="onset") |
| 976 | assert_allclose(a.duration, b.duration, rtol=0, atol=tol, err_msg="duration") |
| 977 | assert_array_equal(a.description, b.description, err_msg="description") |
| 978 | assert_array_equal(a.ch_names, b.ch_names, err_msg="ch_names") |
| 979 | a_orig_time = a.orig_time |
| 980 | b_orig_time = b.orig_time |
| 981 | assert a_orig_time == b_orig_time, "orig_time" |
| 982 | extras_columns = a._extras_columns.union(b._extras_columns) |
| 983 | for col in extras_columns: |
| 984 | for i, extra in enumerate(a.extras): |
| 985 | exa = extra.get(col, None) |
| 986 | exb = b.extras[i].get(col, None) |
| 987 | if comp_extras_as_str: |
| 988 | exa = str(exa) if exa is not None else "" |
| 989 | exb = str(exb) if exb is not None else "" |
| 990 | assert exa == exb, f"extras[{i}][{col}]" |
| 991 | |
| 992 | |
| 993 | _ORIG_TIME = datetime.fromtimestamp(1038942071.7201, timezone.utc) |
no outgoing calls
no test coverage detected