Skip to content

Commit

Permalink
[#161] Add a test for xgboost classifier support
Browse files Browse the repository at this point in the history
This test is currently failing if you have xgboost installed. If you don't have
xgboost installed, it skips itself to prevent failures due to missing packages
and dependencies.
  • Loading branch information
riley-harper committed Nov 14, 2024
1 parent fbb4b44 commit a51f20f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions hlink/tests/core/classifier_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest

from hlink.linking.core.classifier import choose_classifier

try:
import xgboost
except ModuleNotFoundError:
xgboost_available = False
else:
xgboost_available = True

@pytest.mark.skipif(not xgboost_available, reason="requires the xgboost library")
def test_choose_classifier_supports_xgboost():
"""
If the xgboost module is installed, then choose_classifier() supports a model
type of "xgboost".
"""
params = {
"max_depth": 2,
"eta": 0.5,
}
classifier = choose_classifier("xgboost", params, "match")
assert classifier.getLabelCol() == "match"

0 comments on commit a51f20f

Please sign in to comment.