Skip to content

Commit

Permalink
Avoid warning in np primitive type tests. (#7833)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Apr 22, 2022
1 parent c45665a commit 3323804
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/python/test_basic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def test_feature_info(self):
y = rng.randn(rows)
feature_names = ["test_feature_" + str(i) for i in range(cols)]
X_pd = pd.DataFrame(X, columns=feature_names)
X_pd.iloc[:, 3] = X_pd.iloc[:, 3].astype(np.int)
X_pd.iloc[:, 3] = X_pd.iloc[:, 3].astype(np.int32)

Xy = xgb.DMatrix(X_pd, y)
assert Xy.feature_types[3] == "int"
Expand Down
10 changes: 7 additions & 3 deletions tests/python/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,23 @@ def test_dtypes(self):
predt_orig = self.booster.inplace_predict(orig)
# all primitive types in numpy
for dtype in [
np.signedinteger,
np.int32,
np.int64,
np.byte,
np.short,
np.intc,
np.int_,
np.longlong,
np.unsignedinteger,
np.uint32,
np.uint64,
np.ubyte,
np.ushort,
np.uintc,
np.uint,
np.ulonglong,
np.floating,
np.float16,
np.float32,
np.float64,
np.half,
np.single,
np.double,
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_with_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,5 +328,5 @@ def test_bool(dtype) -> bytes:
return to_bytes(Xy)

b0 = test_bool(pd.BooleanDtype())
b1 = test_bool(np.bool)
b1 = test_bool(bool)
assert b0 != b1 # None is converted to False with np.bool

0 comments on commit 3323804

Please sign in to comment.