Testing Utilities#
Utility functions for writings tests for AtomArray objects.
- atomworks.io.utils.testing.assert_same_atom_array(arr1: AtomArray | AtomArrayStack, arr2: AtomArray | AtomArrayStack, compare_coords: bool = True, compare_bonds: bool = True, compare_box: bool = False, annotations_to_compare: list[str] | None = None, enforce_order: bool = True, compare_bond_order: bool = True, _n_mismatches_to_show: int = 5) None [source]#
Asserts that two AtomArray objects are equal.
- Parameters:
arr1 (AtomArray) – The first AtomArray to compare.
arr2 (AtomArray) – The second AtomArray to compare.
compare_coords (bool, optional) – Whether to compare coordinates. Defaults to True.
compare_bonds (bool, optional) – Whether to compare bonds. Defaults to True.
compare_box (bool, optional) – Whether to compare the box attribute. Defaults to False.
annotations_to_compare (list[str] | None, optional) – List of annotation categories to compare. Defaults to None, in which case all annotations are compared.
enforce_order (bool, optional) – Whether to enforce the order of the atoms. Defaults to True. NOTE: Enforcing order is much faster; use False only when strictly necessary.
compare_bond_order (bool, optional) – Whether to compare bond order. Defaults to True.
_n_mismatches_to_show (int, optional) – Number of mismatches to show. Defaults to 20.
WARNING: If AtomArrayStack objects are passed, only the first array is compared.
- Raises:
AssertionError – If the AtomArray objects are not equal.