Skip to content

Commit

Permalink
TST: re-enabled CIF scraper tests
Browse files Browse the repository at this point in the history
Conflicts:
	matador/tests/test_file_io.py
  • Loading branch information
ml-evs committed Jun 11, 2019
1 parent 106d33c commit 5d8ae99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion matador/scrapers/cif_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _cif_set_unreduced_sites(doc):
unreduced_species = []
for species in species_sites:
unreduced_sites_spec, indices = np.unique(species_sites[species],
return_index=True, axis=1)
return_index=True, axis=0)
unreduced_occupancies_spec = np.asarray(species_occ[species])[indices].tolist()
unreduced_occupancies.extend(unreduced_occupancies_spec)
unreduced_sites.extend(unreduced_sites_spec.tolist())
Expand Down
9 changes: 4 additions & 5 deletions matador/tests/test_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,6 @@ def test_fortran_e100_bug(self):
pdis, s = cell2dict(cell_fname, db=False, lattice=True, verbosity=VERBOSITY)
self.assertTrue(s)

@unittest.skipIf(True, 'CIF tests temporarily disabled...')
def test_cif(self):
cif_fname = REAL_PATH + 'data/cif_files/AgBiI.cif'
failed_open = False
Expand All @@ -859,9 +858,9 @@ def test_cif(self):
test_dict, s = cif2dict(cif_fname)
self.assertTrue(s, 'Failed entirely, oh dear! {}'.format(test_dict))
self.assertAlmostEqual(test_dict['num_atoms'], 46.623999999999995, msg='Failed to read num_atoms!', places=5)
self.assertTrue(['Bi', 1.0] in test_dict['stoichiometry'], msg='Wrong stoichiometry!')
self.assertTrue(['I', 4.0] in test_dict['stoichiometry'], msg='Wrong stoichiometry!')
self.assertTrue(sorted(test_dict['stoichiometry']) == test_dict['stoichiometry'], msg='Wrong stoichiometry!')
Bi_ratio = [elem[1] for elem in test_dict['stoichiometry'] if elem[0] == 'Bi'][0]
I_ratio = [elem[1] for elem in test_dict['stoichiometry'] if elem[0] == 'I'][0]
self.assertEqual(I_ratio/Bi_ratio, 4)
self.assertAlmostEqual(test_dict['cell_volume'], 1826.0028753, msg='Wrong cell volume!', places=3)
self.assertEqual(test_dict['space_group'], 'Fd-3m', msg='Wrong space group!')
self.assertEqual(len(test_dict['atom_types']), 64)
Expand All @@ -879,7 +878,7 @@ def test_cif(self):
f.close()
errored = False
test_dict, s = cif2dict(cif_fname)
errored = isinstance(test_dict, RuntimeError) and 'RuntimeError' in test_dict
errored = isinstance(test_dict, RuntimeError) or 'RuntimeError' in test_dict
self.assertTrue(errored, 'WARNING: malicious attack is possible through symops')
self.assertFalse(s, 'This should have failed entirely, oh dear!')

Expand Down

0 comments on commit 5d8ae99

Please sign in to comment.