summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2013-10-12 23:39:32 -0400
committerMarten van Kerkwijk <mhvk@astro.utoronto.ca>2013-10-12 23:39:32 -0400
commit3d9d9aa60adf788567a888f0419a4155bcab8693 (patch)
tree17305e32a31787959f23c0ec0ffc85b2bb877ac4
parentbeb1911b68e791923c56c9c99adfb14a036c20bd (diff)
downloadnumpy-3d9d9aa60adf788567a888f0419a4155bcab8693.tar.gz
One revert (comparisons with None; not PEP8, but good to check); extra comments
-rw-r--r--numpy/ma/tests/test_core.py22
-rw-r--r--numpy/ma/tests/test_mrecords.py1
2 files changed, 13 insertions, 10 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 56eb91996..6608cce63 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -1113,23 +1113,25 @@ class TestMaskedArrayArithmetic(TestCase):
assert_equal(test.mask, [False, False])
def test_eq_w_None(self):
+ # Really, comparisons with None should not be done, but
+ # check them anyway
# With partial mask
a = array([1, 2], mask=[0, 1])
- assert_equal(a is None, False)
- assert_equal(a.data is None, False)
- assert_equal(a.mask is None, False)
- assert_equal(a is not None, True)
+ assert_equal(a == None, False)
+ assert_equal(a.data == None, False)
+ assert_equal(a.mask == None, False)
+ assert_equal(a != None, True)
# With nomask
a = array([1, 2], mask=False)
- assert_equal(a is None, False)
- assert_equal(a is not None, True)
+ assert_equal(a == None, False)
+ assert_equal(a != None, True)
# With complete mask
a = array([1, 2], mask=True)
- assert_equal(a is None, False)
- assert_equal(a is not None, True)
- # With masked
+ assert_equal(a == None, False)
+ assert_equal(a != None, True)
+ # Fully masked, even comparison to None should return "masked"
a = masked
- assert_equal(a == 1, masked)
+ assert_equal(a == None, masked)
def test_eq_w_scalar(self):
a = array(1)
diff --git a/numpy/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py
index c00407879..54945e8f0 100644
--- a/numpy/ma/tests/test_mrecords.py
+++ b/numpy/ma/tests/test_mrecords.py
@@ -511,6 +511,7 @@ def test_record_array_with_object_field():
[(1, '2'), (3, '4')],
mask=[(0, 0), (0, 1)],
dtype=[('a', int), ('b', np.object)])
+ # getting an item used to fail
y[1]