-
Notifications
You must be signed in to change notification settings - Fork 33
chore: deprecate assignUniqueLabels #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
8b5c62d
b692fb6
e9c39fe
2a1f30e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| **Added:** | ||
|
|
||
| * No News Added: deprecate assignUniqueLabels method | ||
|
|
||
| **Changed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Deprecated:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Removed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Fixed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Security:** | ||
|
|
||
| * <news item> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| numpy | ||
| pycifrw | ||
| diffpy.utils |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| numpy | ||
| pycifrw | ||
| diffpy.utils |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,18 +121,29 @@ def test___copy__(self): | |
| # return | ||
|
|
||
| def test_assignUniqueLabels(self): | ||
| """Check Structure.assignUniqueLabels()""" | ||
| """Duplicate test with the deprecated assignUniqueLabels method. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to do this. This test will start failing when we remove the function so these will be easy to find and remove.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sbillinge So, what we need to contain here? should we maintain the original docstring here? |
||
|
|
||
| Remove this test in version 4.0.0 | ||
| """ | ||
| self.assertEqual("", "".join([a.label for a in self.stru])) | ||
| self.stru.assignUniqueLabels() | ||
| self.assertEqual("C1", self.stru[0].label) | ||
| self.assertEqual("C2", self.stru[1].label) | ||
| return | ||
|
|
||
| def test_assign_unique_labels(self): | ||
| """Check Structure.assignUniqueLabels()""" | ||
| self.assertEqual("", "".join([a.label for a in self.stru])) | ||
| self.stru.assign_unique_labels() | ||
| self.assertEqual("C1", self.stru[0].label) | ||
| self.assertEqual("C2", self.stru[1].label) | ||
| return | ||
|
|
||
| def test_distance(self): | ||
| """Check Structure.distance()""" | ||
| from math import sqrt | ||
|
|
||
| self.stru.assignUniqueLabels() | ||
| self.stru.assign_unique_labels() | ||
| self.assertRaises(IndexError, self.stru.distance, 333, "C1") | ||
| self.assertRaises(IndexError, self.stru.distance, "C", "C1") | ||
| self.assertAlmostEqual(sqrt(2.0), self.stru.distance(0, 1), self.places) | ||
|
|
@@ -143,7 +154,7 @@ def test_distance(self): | |
| def test_angle(self): | ||
| """Check Structure.angle()""" | ||
| cdse = Structure(filename=self.cdsefile) | ||
| cdse.assignUniqueLabels() | ||
| cdse.assign_unique_labels() | ||
| self.assertEqual(109, round(cdse.angle(0, 2, 1))) | ||
| self.assertEqual(109, round(cdse.angle("Cd1", "Se1", "Cd2"))) | ||
| return | ||
|
|
@@ -236,7 +247,7 @@ def test___getitem__(self): | |
| cdse013.pop(2) | ||
| self.assertEqual(cdse013, cdse[:2, 3].tolist()) | ||
| self.assertRaises(IndexError, cdse.__getitem__, "Cd1") | ||
| cdse.assignUniqueLabels() | ||
| cdse.assign_unique_labels() | ||
| self.assertTrue(cdse[0] is cdse["Cd1"]) | ||
| cdse[0].label = "Hohenzollern" | ||
| self.assertRaises(IndexError, cdse.__getitem__, "Cd1") | ||
|
|
@@ -466,7 +477,7 @@ def test_label(self): | |
| """Check Structure.label.""" | ||
| cdse = Structure(filename=self.cdsefile) | ||
| self.assertEqual(4 * [""], cdse.label.tolist()) | ||
| cdse.assignUniqueLabels() | ||
| cdse.assign_unique_labels() | ||
| self.assertEqual("Cd1 Cd2 Se1 Se2".split(), cdse.label.tolist()) | ||
| cdse.label = cdse.label.lower() | ||
| self.assertEqual("cd1 cd2 se1 se2".split(), cdse.label.tolist()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this no news. Don't we need to list what we deprecate and what we add?