@@ -157,7 +157,6 @@ def test_cmplx(self):
157
157
assert_ (not isinstance (out , np .ndarray ))
158
158
159
159
160
- @pytest .mark .xfail (reason = "not implemented" )
161
160
class TestIscomplex :
162
161
163
162
def test_fail (self ):
@@ -171,7 +170,6 @@ def test_pass(self):
171
170
assert_array_equal (res , [1 , 0 , 0 ])
172
171
173
172
174
- @pytest .mark .xfail (reason = "not implemented" )
175
173
class TestIsreal :
176
174
177
175
def test_pass (self ):
@@ -184,6 +182,11 @@ def test_fail(self):
184
182
res = isreal (z )
185
183
assert_array_equal (res , [0 , 1 , 1 ])
186
184
185
+ def test_isreal_real (self ):
186
+ z = np .array ([- 1 , 0 , 1 ])
187
+ res = isreal (z )
188
+ assert res .all ()
189
+
187
190
188
191
@pytest .mark .xfail (reason = "not implemented" )
189
192
class TestIscomplexobj :
@@ -202,42 +205,6 @@ def test_list(self):
202
205
assert_ (iscomplexobj ([3 , 1 + 0j , True ]))
203
206
assert_ (not iscomplexobj ([3 , 1 , True ]))
204
207
205
- def test_duck (self ):
206
- class DummyComplexArray :
207
- @property
208
- def dtype (self ):
209
- return np .dtype (complex )
210
- dummy = DummyComplexArray ()
211
- assert_ (iscomplexobj (dummy ))
212
-
213
- def test_pandas_duck (self ):
214
- # This tests a custom np.dtype duck-typed class, such as used by pandas
215
- # (pandas.core.dtypes)
216
- class PdComplex (np .complex128 ):
217
- pass
218
- class PdDtype :
219
- name = 'category'
220
- names = None
221
- type = PdComplex
222
- kind = 'c'
223
- str = '<c16'
224
- base = np .dtype ('complex128' )
225
- class DummyPd :
226
- @property
227
- def dtype (self ):
228
- return PdDtype
229
- dummy = DummyPd ()
230
- assert_ (iscomplexobj (dummy ))
231
-
232
- def test_custom_dtype_duck (self ):
233
- class MyArray (list ):
234
- @property
235
- def dtype (self ):
236
- return complex
237
-
238
- a = MyArray ([1 + 0j , 2 + 0j , 3 + 0j ])
239
- assert_ (iscomplexobj (a ))
240
-
241
208
242
209
@pytest .mark .xfail (reason = "not implemented" )
243
210
class TestIsrealobj :
0 commit comments