Skip to content

Commit 96e1bf5

Browse files
committed
addtional tests showing exceptions for malformed complex numbers
1 parent c2b5e6e commit 96e1bf5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/test_delimited_to_arrays.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,14 @@ def test_iterable_str_to_array_1d_complex_4(self) -> None:
370370
self.assertEqual(a1.dtype, np.dtype(complex))
371371
self.assertEqual(a1.tolist(), [complex('-0+infj'), (0j)])
372372

373-
# NOTE: this causes a seg fault
374-
# def test_iterable_str_to_array_1d_d4(self) -> None:
375-
# with self.assertRaises(ValueError):
376-
# a1 = iterable_str_to_array_1d(['-2+1.2j', '1.5+-4.2j'], complex)
373+
def test_iterable_str_to_array_1d_complex_5(self) -> None:
374+
with self.assertRaises(ValueError):
375+
a1 = iterable_str_to_array_1d(['-2+1.2j', '1.5+-4.2j'], complex)
376+
377+
def test_iterable_str_to_array_1d_complex_6(self) -> None:
378+
# NOTE: malformed complex raise Exception as expected
379+
with self.assertRaises(ValueError):
380+
a1 = iterable_str_to_array_1d(['-2+1.2asdfj', '1.5wer4.2j'], complex)
377381

378382
#---------------------------------------------------------------------------
379383

0 commit comments

Comments
 (0)