Py_DECREF(mod_nattype);
}
- /* Initialise numpy API and use 2/3 compatible return */
+ /* Initialise numpy API */
import_array();
- return NUMPY_IMPORT_ARRAY_RETVAL;
+ return NULL;
}
static TypeContext *createTypeContext(void) {
assert not is_dtype_equal(self.dtype, np.int64)
def test_numpy_informed(self):
- with pytest.raises(TypeError, match="data type not understood"):
+ with pytest.raises(TypeError, match="data type not understood|Cannot interpret .* as a data type"):
np.dtype(self.dtype)
assert not self.dtype == np.str_
# Check that bad types raise
(
dict(index=False, column_dtypes={"A": "int32", "B": "foo"}),
- (TypeError, 'data type "foo" not understood'),
+ (TypeError, 'data type .foo. not understood'),
),
],
)
with pytest.raises(ValueError, match=msg):
idx.take(np.array([1, 0, -5]), fill_value=True)
- msg = "index -5 is out of bounds for size 4"
+ msg = "index -5 is out of bounds for.* size 4"
with pytest.raises(IndexError, match=msg):
idx.take(np.array([1, -5]))
with pytest.raises(ValueError, match=msg):
idx.take(np.array([1, 0, -5]), fill_value=True)
- msg = "index -5 is out of bounds for size 3"
+ msg = "index -5 is out of bounds for.* size 3"
with pytest.raises(IndexError, match=msg):
idx.take(np.array([1, -5]))
with catch_warnings():
filterwarnings("ignore", category=FutureWarning)
+ filterwarnings("ignore", category=DeprecationWarning)
i_rec = self.encode_decode(self.frame, compress=compress)
for k in self.frame.keys():
with tm.assert_produces_warning(None):
with catch_warnings():
filterwarnings("ignore", category=FutureWarning)
+ filterwarnings("ignore", category=DeprecationWarning)
empty_unpacked = self.encode_decode(empty, compress=compress)
tm.assert_numpy_array_equal(empty_unpacked, empty)
with tm.assert_produces_warning(None):
with catch_warnings():
filterwarnings("ignore", category=FutureWarning)
+ filterwarnings("ignore", category=DeprecationWarning)
char_unpacked = self.encode_decode(char, compress=compress)
tm.assert_numpy_array_equal(char_unpacked, char)
# GH#18846
td = Timedelta(hours=3, minutes=3)
- dt64 = np.datetime64("2016-01-01", dtype="datetime64[us]")
+ dt64 = np.datetime64("2016-01-01", "us")
with pytest.raises(TypeError):
td.__rfloordiv__(dt64)
for date_string in out_of_bounds_dates:
for unit in time_units:
- dt64 = np.datetime64(date_string, dtype="M8[{unit}]".format(unit=unit))
+ dt64 = np.datetime64(date_string, unit)
with pytest.raises(ValueError):
Timestamp(dt64)
for date_string in in_bounds_dates:
for unit in time_units:
- dt64 = np.datetime64(date_string, dtype="M8[{unit}]".format(unit=unit))
+ dt64 = np.datetime64(date_string, unit)
Timestamp(dt64)
def test_min_valid(self):
expected = Series([4, 2, 4], index=[4, 3, 4])
tm.assert_series_equal(actual, expected)
- msg = "index {} is out of bounds for size 5"
+ msg = "index {} is out of bounds for.* size 5"
with pytest.raises(IndexError, match=msg.format(10)):
s.take([1, 10])
with pytest.raises(IndexError, match=msg.format(5)):
self._check_all(_compare_with_dense)
- msg = "index 21 is out of bounds for size 20"
+ msg = "index 21 is out of bounds for.* size 20"
with pytest.raises(IndexError, match=msg):
self.bseries.take([0, len(self.bseries) + 1])
continue
if actual_warning.category==DeprecationWarning and ('jedi' in actual_warning.filename or 'IPython' in actual_warning.filename):
continue
+ if actual_warning.category==np.VisibleDeprecationWarning and "Creating an ndarray from ragged nested sequences" in str(actual_warning.message):
+ continue
extra_warnings.append(
(
actual_warning.category.__name__,