Skip to content

Commit

Permalink
Update tests according to #305
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Jun 11, 2020
1 parent 997b79b commit 2ec9dd2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/adapters/structures/test_jarvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
def test_successful_conversion(RAW_STRUCTURES):
"""Make sure its possible to convert"""
for structure in RAW_STRUCTURES:
print("Structure(structure)", Structure(structure))
assert isinstance(get_jarvis_atoms(Structure(structure)), Atoms)


Expand All @@ -39,8 +38,16 @@ def test_special_species(SPECIAL_SPECIES_STRUCTURES):
for special_structure in SPECIAL_SPECIES_STRUCTURES:
structure = Structure(special_structure)

with pytest.raises(
ConversionError,
match="jarvis-tools cannot handle structures with partial occupancies",
):
get_jarvis_atoms(structure)
# Since all the special species structure only have a single species, this works fine.
if len(structure.species[0].chemical_symbols) > 1:
# If the structure is disordered (has partial occupancies of any kind),
# jarvis-tools cannot convert the structure
with pytest.raises(
ConversionError,
match="jarvis-tools cannot handle structures with partial occupancies",
):
get_jarvis_atoms(structure)
else:
# No partial occupancies, just special/non-standard species.
# jarvis-tools should convert these structure fine enough.
assert isinstance(get_jarvis_atoms(structure), Atoms)

0 comments on commit 2ec9dd2

Please sign in to comment.