diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-07-30 23:00:50 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-07-30 23:02:10 -0700 |
commit | aea9eb20898770a0b1b494a2bc646bd46afa5bab (patch) | |
tree | c558392cf6cc42c20660ad8a721cab39beb4183a /numpy/lib/tests | |
parent | e7a0f7575c69222e0c0104939837c5c9eeae4380 (diff) | |
download | numpy-aea9eb20898770a0b1b494a2bc646bd46afa5bab.tar.gz |
ENH: np.angle: Preserve subclasses
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index ba5b90e8c..d5faed6ae 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1043,6 +1043,16 @@ class TestAngle(object): assert_array_almost_equal(y, yo, 11) assert_array_almost_equal(z, zo, 11) + def test_subclass(self): + x = np.ma.array([1 + 3j, 1, np.sqrt(2)/2 * (1 + 1j)]) + x[1] = np.ma.masked + expected = np.ma.array([np.arctan(3.0 / 1.0), 0, np.arctan(1.0)]) + expected[1] = np.ma.masked + actual = angle(x) + assert_equal(type(actual), type(expected)) + assert_equal(actual.mask, expected.mask) + assert_equal(actual, expected) + class TestTrimZeros(object): |