Skip to content

Commit a5e72dc

Browse files
committed
build: change version number and refactor name of function.
1 parent b5c3cbc commit a5e72dc

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

src/diffpy/structure/structure.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,8 @@
2525
# ----------------------------------------------------------------------------
2626

2727
base = "diffpy.structure.Structure"
28-
removal_version = "3.8.0"
28+
removal_version = "4.0.0"
2929

30-
addNewAtom_deprecation_msg = build_deprecation_message(
31-
base,
32-
"addNewAtom",
33-
"add_new_atom",
34-
removal_version,
35-
)
3630
getLastAtom_deprecation_msg = build_deprecation_message(
3731
base,
3832
"getLastAtom",
@@ -208,17 +202,6 @@ def add_new_atom(self, *args, **kwargs):
208202
self.append(a, copy=False)
209203
return
210204

211-
@deprecated(addNewAtom_deprecation_msg)
212-
def addNewAtom(self, *args, **kwargs):
213-
"""This function has been deprecated and will be removed in
214-
version 3.8.0.
215-
216-
Please use diffpy.structure.Structure.add_new_atom instead.
217-
"""
218-
kwargs["lattice"] = self.lattice
219-
a = Atom(*args, **kwargs)
220-
self.append(a, copy=False)
221-
return
222205

223206
def get_last_atom(self):
224207
"""Return Reference to the last `Atom` in this structure."""
@@ -228,7 +211,7 @@ def get_last_atom(self):
228211
@deprecated(getLastAtom_deprecation_msg)
229212
def getLastAtom(self):
230213
"""This function has been deprecated and will be removed in
231-
version 3.8.0.
214+
version 4.0.0.
232215
233216
Please use diffpy.structure.Structure.get_last_atom instead.
234217
"""
@@ -256,7 +239,7 @@ def assign_unique_labels(self):
256239
@deprecated(assignUniqueLabels_deprecation_msg)
257240
def assignUniqueLabels(self):
258241
"""This function has been deprecated and will be removed in
259-
version 3.8.0.
242+
version 4.0.0.
260243
261244
Please use diffpy.structure.Structure.assgin_unique_labels
262245
instead.
@@ -354,7 +337,7 @@ def place_in_lattice(self, new_lattice):
354337
@deprecated(placeInLattice_deprecation_msg)
355338
def placeInLattice(self, new_lattice):
356339
"""This function has been deprecated and will be removed in
357-
version 3.8.0.
340+
version 4.0.0.
358341
359342
Please use diffpy.structure.Structure.place_in_lattice instead.
360343
"""
@@ -436,7 +419,7 @@ def read_str(self, s, format="auto"):
436419
@deprecated(readStr_deprecation_msg)
437420
def readStr(self, s, format="auto"):
438421
"""This function has been deprecated and will be removed in
439-
version 3.8.0.
422+
version 4.0.0.
440423
441424
Please use diffpy.structure.Structure.read_str instead.
442425
"""
@@ -496,7 +479,7 @@ def write_str(self, format):
496479
@deprecated(writeStr_deprecation_msg)
497480
def writeStr(self, format):
498481
"""This function has been deprecated and will be removed in
499-
version 3.8.0.
482+
version 4.0.0.
500483
501484
Please use diffpy.structure.Structure.write_str instead.
502485
"""

tests/test_p_cif.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,33 @@ def test_parseFile(self):
197197
# """
198198
# return
199199

200+
def test_Write_and_Read(self):
201+
"""High-level check of P_cif.tostring()"""
202+
# high-level check
203+
stru_check = Structure()
204+
stru_check.read(self.cdsebulkpdffitfile)
205+
s_s = stru_check.writeStr("cif")
206+
stru = Structure()
207+
stru.readStr(s_s, "cif")
208+
self.assertAlmostEqual(4.2352, stru.lattice.a, self.places)
209+
self.assertAlmostEqual(4.2352, stru.lattice.b, self.places)
210+
self.assertAlmostEqual(6.90603, stru.lattice.c, self.places)
211+
self.assertEqual(4, len(stru))
212+
a0 = stru[0]
213+
self.assertEqual("Cd", a0.element)
214+
self.assertTrue(numpy.allclose([0.3334, 0.6667, 0.0], a0.xyz))
215+
self.assertTrue(a0.anisotropy)
216+
self.assertAlmostEqual(0.01303, a0.U[0, 0])
217+
self.assertAlmostEqual(0.01303, a0.U[1, 1])
218+
self.assertAlmostEqual(0.01402, a0.U[2, 2])
219+
a3 = stru[3]
220+
self.assertEqual("Se", a3.element)
221+
self.assertTrue(numpy.allclose([0.6666, 0.333300, 0.87667], a3.xyz))
222+
self.assertAlmostEqual(0.015673, a3.U[0, 0])
223+
self.assertAlmostEqual(0.015673, a3.U[1, 1])
224+
self.assertAlmostEqual(0.046164, a3.U[2, 2])
225+
return
226+
200227
def test_write_and_read(self):
201228
"""High-level check of P_cif.tostring()"""
202229
# high-level check

0 commit comments

Comments
 (0)