Skip to content

Commit

Permalink
Merge commit '9e2b49bb5b3e98914b1fbd9e0eff812303676556'
Browse files Browse the repository at this point in the history
  • Loading branch information
skrah committed Mar 19, 2019
2 parents e4277fe + 9e2b49b commit 92e9584
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion xnd/python/test_xnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3096,10 +3096,11 @@ def test_endian(self):
'h', 'i', 'l', 'q',
'H', 'I', 'L', 'Q',
'f', 'd',
'F', 'D',
]

if HAVE_PYTHON_36:
standard += 'e'
standard += ['e']

modifiers = ['', '<', '>']

Expand Down Expand Up @@ -3132,6 +3133,24 @@ def test_readonly(self):
self.assertEqual(x.tolist(), [1000, 2000, 3000])
check_copy_contiguous(self, y)

@unittest.skipIf(np is None, "numpy not found")
def test_complex(self):
x = xnd([1, 2, 3], dtype="complex64")
y = np.array(x)
self.assertEqual(memoryview(y).format, "Zf")

x = xnd([1, 2, 3], dtype="complex128")
y = np.array(x)
self.assertEqual(memoryview(y).format, "Zd")

x = np.array([1, 2, 3], dtype="complex64")
y = xnd.from_buffer(x)
self.assertEqual(memoryview(y).format, "=Zf")

x = np.array([1, 2, 3], dtype="complex128")
y = xnd.from_buffer(x)
self.assertEqual(memoryview(y).format, "=Zd")


class TestReshape(XndTestCase):

Expand Down

0 comments on commit 92e9584

Please sign in to comment.