MCPcopy Create free account
hub / github.com/numpy/numpy / test_complex_parsing

Function test_complex_parsing

numpy/lib/tests/test_loadtxt.py:428–437  ·  view source on GitHub ↗
(dtype, with_parens)

Source from the content-addressed store, hash-verified

426@pytest.mark.parametrize("dtype", (np.complex64, np.complex128))
427@pytest.mark.parametrize("with_parens", (False, True))
428def test_complex_parsing(dtype, with_parens):
429 s = "(1.0-2.5j),3.75,(7+-5.0j)\n(4),(-19e2j),(0)"
430 if not with_parens:
431 s = s.replace("(", "").replace(")", "")
432
433 res = np.loadtxt(StringIO(s), dtype=dtype, delimiter=",")
434 expected = np.array(
435 [[1.0-2.5j, 3.75, 7-5j], [4.0, -1900j, 0]], dtype=dtype
436 )
437 assert_equal(res, expected)
438
439
440def test_read_from_generator():

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
replaceMethod · 0.80

Tested by

no test coverage detected