Skip to content

Commit f1e613d

Browse files
committed
BUG: make handling of masked arrays more specific
Only retry on a masked array if it actually has masked values.
1 parent 1b411f7 commit f1e613d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scpdt/impl.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ def try_convert_namedtuple(got):
217217
return got_again
218218

219219

220+
def has_masked(got):
221+
return 'masked_array' in got and '--' in got
222+
223+
220224
class DTChecker(doctest.OutputChecker):
221225
obj_pattern = re.compile(r'at 0x[0-9a-fA-F]+>')
222226
vanilla = doctest.OutputChecker()
@@ -289,7 +293,7 @@ def check_output(self, want, got, optionflags):
289293
# maybe we are dealing with masked arrays?
290294
# their repr uses '--' for masked values and this is invalid syntax
291295
# If so, replace '--' by nans (they are masked anyway) and retry
292-
if 'masked_array' in want or 'masked_array' in got:
296+
if has_masked(want) or has_masked(got):
293297
s_want = want.replace('--', 'nan')
294298
s_got = got.replace('--', 'nan')
295299
return self.check_output(s_want, s_got, optionflags)

0 commit comments

Comments
 (0)