Skip to content

Commit

Permalink
Replace np.str with str in io.ascii
Browse files Browse the repository at this point in the history
TST: Ignore RuntimeWarning
in astropy/table/tests/test_table.py that pops up when
use_nullable_int is False and pandas is 1.5.2

Co-authored-by: Marten van Kerkwijk <mhvk@astro.utoronto.ca>
  • Loading branch information
pllim and mhvk committed Nov 30, 2022
1 parent 9a7b4f0 commit b47af9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion astropy/io/ascii/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ def _convert_vals(self, cols):
f" column {col.name}, reverting to String.",
AstropyWarning,
)
col.converters.insert(0, convert_numpy(numpy.str))
col.converters.insert(0, convert_numpy(str))
else:
col.converters.pop(0)
last_err = err
Expand Down
5 changes: 4 additions & 1 deletion astropy/table/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,10 @@ def test_masking(self, use_nullable_int):
else:
assert t2[name].dtype.kind == "i"

assert_array_equal(column.data, t2[name].data.astype(column.dtype))
# This warning pops up when use_nullable_int is False
# for pandas 1.5.2.
with np.errstate(invalid='ignore'):
assert_array_equal(column.data, t2[name].data.astype(column.dtype))
else:
if column.dtype.byteorder in ("=", "|"):
assert column.dtype == t2[name].dtype
Expand Down

0 comments on commit b47af9d

Please sign in to comment.