Skip to content

Commit cfae583

Browse files
committed
fix minor bug in typeerror test
1 parent beec69c commit cfae583

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/diffpy/structure/structure.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ def get_cartesian_coordinates(self):
214214
return cartn_coords
215215

216216
def get_anisotropic_displacement_parameters(self, return_array=False):
217-
"""Return a dictionary of anisotropic displacement parameters
218-
for all atoms.
217+
"""Return the anisotropic displacement parameters for all atoms.
219218
220219
Parameters
221220
----------
@@ -244,8 +243,7 @@ def get_anisotropic_displacement_parameters(self, return_array=False):
244243
return adp_dict
245244

246245
def get_isotropic_displacement_parameters(self, return_array=False):
247-
"""Return a dictionary of isotropic displacement parameters for
248-
all atoms.
246+
"""Return a the isotropic displacement parameters for all atoms.
249247
250248
Parameters
251249
----------
@@ -368,7 +366,7 @@ def convert_ase_to_diffpy_structure(
368366
To extract additional information from the ASE `Atoms` object that is not
369367
directly represented in the `Structure` class, such as magnetic moments,
370368
you can specify an attribute or method of `ASE.Atoms` as
371-
a list of strings in `lost_info` list. For example,
369+
a string or list of strings in `lost_info` list. For example,
372370
373371
.. code-block:: python
374372
lost_info = structure.convert_ase_to_diffpy(
@@ -381,7 +379,7 @@ def convert_ase_to_diffpy_structure(
381379
# clear structure before populating it with new atoms
382380
del self[:]
383381
if not isinstance(ase_atoms, ASEAtoms):
384-
raise TypeError(f"Input must be an instance of ase.Atoms but got type {ase_atoms}.")
382+
raise TypeError(f"Input must be an instance of ase.Atoms but got type {type(ase_atoms)}.")
385383
cell = ase_atoms.get_cell()
386384
self.lattice = Lattice(base=numpy.array(cell))
387385
symbols = ase_atoms.get_chemical_symbols()

tests/test_structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ def test_convert_ase_to_diffpy_structure(input, build_ase_atom_object, build_dif
897897
def test_convert_ase_to_diffpy_structure_bad_typeerror():
898898
"""Check convert_ase_to_diffpy_structure() with bad input."""
899899
bad_input = "string" # pass a string instead of ase.Atoms
900-
expected_error_msg = "Input must be an instance of ase.Atoms but got type str."
900+
expected_error_msg = "Input must be an instance of ase.Atoms but got type <class 'str'>."
901901
actual_structure = Structure()
902902
with pytest.raises(TypeError, match=expected_error_msg):
903903
actual_structure.convert_ase_to_diffpy_structure(bad_input)

0 commit comments

Comments
 (0)