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

Method test_conjugate

numpy/core/tests/test_multiarray.py:3595–3630  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3593 b = c
3594
3595 def test_conjugate(self):
3596 a = np.array([1-1j, 1+1j, 23+23.0j])
3597 ac = a.conj()
3598 assert_equal(a.real, ac.real)
3599 assert_equal(a.imag, -ac.imag)
3600 assert_equal(ac, a.conjugate())
3601 assert_equal(ac, np.conjugate(a))
3602
3603 a = np.array([1-1j, 1+1j, 23+23.0j], 'F')
3604 ac = a.conj()
3605 assert_equal(a.real, ac.real)
3606 assert_equal(a.imag, -ac.imag)
3607 assert_equal(ac, a.conjugate())
3608 assert_equal(ac, np.conjugate(a))
3609
3610 a = np.array([1, 2, 3])
3611 ac = a.conj()
3612 assert_equal(a, ac)
3613 assert_equal(ac, a.conjugate())
3614 assert_equal(ac, np.conjugate(a))
3615
3616 a = np.array([1.0, 2.0, 3.0])
3617 ac = a.conj()
3618 assert_equal(a, ac)
3619 assert_equal(ac, a.conjugate())
3620 assert_equal(ac, np.conjugate(a))
3621
3622 a = np.array([1-1j, 1+1j, 1, 2.0], object)
3623 ac = a.conj()
3624 assert_equal(ac, [k.conjugate() for k in a])
3625 assert_equal(ac, a.conjugate())
3626 assert_equal(ac, np.conjugate(a))
3627
3628 a = np.array([1-1j, 1, 2.0, 'f'], object)
3629 assert_raises(TypeError, lambda: a.conj())
3630 assert_raises(TypeError, lambda: a.conjugate())
3631
3632 def test_conjugate_out(self):
3633 # Minimal test for the out argument being passed on correctly

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
assert_raisesFunction · 0.90
conjugateMethod · 0.80

Tested by

no test coverage detected