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
DM-10926: Incompatibility with NumPy 1.13 #249
Conversation
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.
I think this is a good usecase for np.testing
. See comments.
tests/test_astropyTableViews.py
Outdated
@@ -127,9 +127,9 @@ def testFlagColumn(self): | |||
"""Test that Flag columns can be viewed if copy=True or unviewable="copy". | |||
""" | |||
v1 = self.catalog.asAstropy(unviewable="copy") | |||
self.assertFloatsAlmostEqual(v1["a4"], self.catalog["a4"]) | |||
self.assertFalse(np.any(np.logical_xor(v1["a4"], self.catalog["a4"]))) |
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.
I wonder if np.testing.assert_array_equal(v1["a4"], self.catalog["a4"])
(and similarly for the below) wouldn't be easier to interpret?
tests/test_simpleTable.py
Outdated
@@ -357,8 +357,9 @@ def testExtract(self): | |||
]: | |||
d = catalog.extract("*", **kwds) | |||
self.assertFloatsEqual(d["a_b_c1"], catalog.get("a_b_c1")[idx]) | |||
self.assertFloatsEqual(d["a_b_c2"], catalog.get("a_b_c2")[idx]) | |||
self.assertFloatsEqual(d["a_d1"], catalog.get("a_d1")[idx]) | |||
self.assertFalse(np.any(np.logical_xor( |
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.
Another case where np.testing
would probably clarify the purpose of the test.
allBits = self.catalog.getBits() | ||
someBits = self.catalog.getBits(["a_flag", "c_flag"]) | ||
self.assertEqual(allBits.getMask("a_flag"), 0x1) | ||
self.assertEqual(allBits.getMask("b_flag"), 0x2) | ||
self.assertEqual(allBits.getMask("c_flag"), 0x4) | ||
self.assertEqual(someBits.getMask(self.fluxFlagKey), 0x1) | ||
self.assertEqual(someBits.getMask(self.shapeFlagKey), 0x2) | ||
self.assertFloatsEqual((allBits.array & 0x1 != 0), |
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.
np.testing
again?
8df0f75
to
2e1d673
Compare
- Stop using assertFloatEqual for non-float fields
2e1d673
to
5553885
Compare
No description provided.