Skip to content

Commit

Permalink
Add python test.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Feb 16, 2019
1 parent 509b683 commit 4924640
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/python/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def test_basic(self):
# assert they are the same
assert np.sum(np.abs(preds2 - preds)) == 0

def test_np_view(self):
y = np.array([12, 34, 56], np.float32)[::2]
from_view = xgb.DMatrix([], label=y).get_label()
from_array = xgb.DMatrix([], label=y+0).get_label()
assert (from_view == from_array).all()

def test_record_results(self):
dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train')
dtest = xgb.DMatrix(dpath + 'agaricus.txt.test')
Expand Down

0 comments on commit 4924640

Please sign in to comment.