diff --git a/mdpow/tests/test_automated_dihedral_analysis.py b/mdpow/tests/test_automated_dihedral_analysis.py index a3f30a73..6535608a 100644 --- a/mdpow/tests/test_automated_dihedral_analysis.py +++ b/mdpow/tests/test_automated_dihedral_analysis.py @@ -128,41 +128,30 @@ def test_build_universe(self, SM25_tmp_dir): solute_names = solute.atoms.names assert solute_names.all() == self.universe_solute_atom_names.all() - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + # Use set comparison because ordering of indices appears to change + # between RDKIT versions; issue raised (#239) to identify and + # resolve exact package/version responsible def test_dihedral_indices(self, atom_indices): atom_group_indices = atom_indices[0] - assert atom_group_indices == self.check_atom_group_indices + assert set(atom_group_indices) == set(self.check_atom_group_indices) - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + # Possible ordering issue (#239) def test_SMARTS(self, atom_indices): atom_group_indices_alt = atom_indices[1] assert atom_group_indices_alt == self.check_atom_group_indices_alt - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + # Use set comparison because ordering of indices appears to change + # between RDKIT versions; issue raised (#239) to identify and + # resolve exact package/version responsible def test_dihedral_groups(self, SM25_tmp_dir): groups = dihedrals.dihedral_groups(dirname=SM25_tmp_dir, resname=self.resname) - i = 0 - while i < len(groups): - assert groups[i].all() == self.check_groups[i].all() - i+=1 - - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + + values = [g.all() for g in groups] + reference = [g.all() for g in self.check_groups] + + assert set(values) == set(reference) + + # Possible ordering issue (#239) def test_dihedral_groups_ensemble(self, dihedral_data): df = dihedral_data[0] @@ -192,11 +181,7 @@ def test_save_df_info(self, dihedral_data, SM25_tmp_dir, caplog): dihedrals.save_df(df=dihedral_data[0], df_save_dir=SM25_tmp_dir, molname='SM25') assert f'Results DataFrame saved as {SM25_tmp_dir}/SM25/SM25_full_df.csv.bz2' in caplog.text, 'Save location not logged or returned' - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + # Possible ordering issue (#239) def test_periodic_angle(self, dihedral_data): df_aug = dihedral_data[1] @@ -209,22 +194,14 @@ def test_periodic_angle(self, dihedral_data): aug_dh2_mean == pytest.approx(self.ADG_C13141520_mean) aug_dh2_var == pytest.approx(self.ADG_C13141520_var) - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + # Possible ordering issue (#239) def test_save_fig(self, SM25_tmp_dir): dihedrals.automated_dihedral_analysis(dirname=SM25_tmp_dir, figdir=SM25_tmp_dir, resname=self.resname, molname='SM25', solvents=('water',)) assert (SM25_tmp_dir / 'SM25' / 'SM25_C10-C5-S4-O11_violins.pdf').exists(), 'PDF file not generated' - # the following 'reason' affects every downstream function that relies - # on the atom indices returned for dihedral atom group selections - # issue raised (#239) to identify and resolve exact package/version responsible - @pytest.mark.skipif(sys.version_info < (3, 8), reason='pytest=7.2.0, build=py37h89c1867_0, ' - 'returns incorrect atom_indices for dihedral atom group selections') + # Possible ordering issue (#239) def test_save_fig_info(self, SM25_tmp_dir, caplog): caplog.clear() caplog.set_level(logging.INFO, logger='mdpow.workflows.dihedrals')