summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_shape_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-04-11 17:42:59 +0100
committerGitHub <noreply@github.com>2017-04-11 17:42:59 +0100
commitf3682860cfe28cd73f46ae290add5d6fdbe43c89 (patch)
tree04cb8b5d806fec5ba25429cd26b5a53f6159c678 /numpy/lib/tests/test_shape_base.py
parent8b6b1bc986b1ca8388975cab8d5264713f607ef0 (diff)
parentfa56437c4eb4ca0c2a97597700a3fc6ad36963fa (diff)
downloadnumpy-f3682860cfe28cd73f46ae290add5d6fdbe43c89.tar.gz
Merge pull request #8643 from eric-wieser/fix-8642
BUG: Fix double-wrapping of object scalars
Diffstat (limited to 'numpy/lib/tests/test_shape_base.py')
-rw-r--r--numpy/lib/tests/test_shape_base.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py
index 8bdf3d3da..4d06001f4 100644
--- a/numpy/lib/tests/test_shape_base.py
+++ b/numpy/lib/tests/test_shape_base.py
@@ -159,6 +159,21 @@ class TestApplyAlongAxis(TestCase):
assert_equal(actual, np.ones(10))
assert_raises(ValueError, np.apply_along_axis, empty_to_1, 0, a)
+ def test_with_iterable_object(self):
+ # from issue 5248
+ d = np.array([
+ [set([1, 11]), set([2, 22]), set([3, 33])],
+ [set([4, 44]), set([5, 55]), set([6, 66])]
+ ])
+ actual = np.apply_along_axis(lambda a: set.union(*a), 0, d)
+ expected = np.array([{1, 11, 4, 44}, {2, 22, 5, 55}, {3, 33, 6, 66}])
+
+ assert_equal(actual, expected)
+
+ # issue 8642 - assert_equal doesn't detect this!
+ for i in np.ndindex(actual.shape):
+ assert_equal(type(actual[i]), type(expected[i]))
+
class TestApplyOverAxes(TestCase):
def test_simple(self):