Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions tests/decisiontree/test_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ def test_growth_params_(self):
)

def test_fit(self):
try:
with pytest.raises(NotImplementedError):
self.model.fit(None, None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("DecisionTreeTemplate.fit expectedly refused call")

def test_predict(self):
try:
with pytest.raises(NotImplementedError):
self.model.predict(None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("DecisionTreeTemplate.predict expectedly refused call")

def test_select_samples_and_features_no_sampling(self):
self.model.frac_features = 1.0
Expand Down
2 changes: 1 addition & 1 deletion tests/decisiontree/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_Node(int_val, float_val, node_val, str_val, bool_val):
if is_okay:
raise ex
else:
pytest.xfail("SplitScore validation failed as expected")
pass # SplitScore validation failed as expected
else:
for att in [
"array_column",
Expand Down
10 changes: 5 additions & 5 deletions tests/decisiontree/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_BestSplit(score, column, threshold, target_groups, default_is_left):
if is_okay:
raise ex
else:
pytest.xfail("BestSplit validation failed as expected")
pass # BestSplit validation failed as expected
else:
if is_bad:
pytest.fail(
Expand Down Expand Up @@ -472,7 +472,7 @@ def test_1d(
)
except ValueError as ex:
if is_homogenous:
pytest.xfail("Splitting a homogneous y failed as expected")
pass # Splitting a homogneous y failed as expected
else:
raise ex
else:
Expand Down Expand Up @@ -524,7 +524,7 @@ def test_1d_missing(
)
except ValueError as ex:
if is_homogenous:
pytest.xfail("Splitting a homogneous y failed as expected")
pass # Splitting a homogneous y failed as expected
else:
raise ex
else:
Expand Down Expand Up @@ -576,7 +576,7 @@ def test_2d(
)
except ValueError as ex:
if is_homogenous:
pytest.xfail("Splitting a homogneous y failed as expected")
pass # Splitting a homogneous y failed as expected
else:
raise ex
else:
Expand Down Expand Up @@ -629,7 +629,7 @@ def test_2d_missing(
)
except ValueError as ex:
if is_homogenous:
pytest.xfail("Splitting a homogneous y failed as expected")
pass # Splitting a homogneous y failed as expected
else:
raise ex
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/decisiontree/test_split_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_SplitScore(name, value):
if is_okay:
raise ValueError(f"whoops {name=} {value=} failed with {ex}")
else:
pytest.xfail("SplitScore validation failed as expected")
pass # SplitScore validation failed as expected
else:
if is_bad:
pytest.fail(
Expand Down
8 changes: 2 additions & 6 deletions tests/test_extratrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ def test_tree_(self):
assert not hasattr(self.model, "trees_")

def test_fit(self):
try:
with pytest.raises(NotImplementedError):
self.model.fit(None, None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("ExtraTreesTemplate.fit expectedly refused call")

def test_predict(self):
try:
with pytest.raises(NotImplementedError):
self.model.predict(None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("ExtraTreesTemplate.predict expectedly refused call")


class TestExtraTreesRegressor:
Expand Down
10 changes: 3 additions & 7 deletions tests/test_gradientboostedtrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ def test_tree_(self):
assert not hasattr(self.model, "trees_")

def test_fit(self):
try:
with pytest.raises(NotImplementedError):
self.model.fit(None, None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("DecisionTreeTemplate.fit expectedly refused call")

def test_predict(self):
try:
with pytest.raises(NotImplementedError):
self.model.predict(None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("DecisionTreeTemplate.predict expectedly refused call")


class TestGradientBoostedTreesRegressor:
Expand Down Expand Up @@ -112,7 +108,7 @@ def test_bool_to_float(x, exp, is_bad: bool):
res = gbt.bool_to_float(x)
except ValueError as ex:
if is_bad:
pytest.xfail("Failed expectedly to convert non-bool values")
pass # Failed expectedly to convert non-bool values
else:
if is_bad:
pytest.fail(f"Passed unexpectedly for non-bool value {x} returning {res}")
Expand Down
8 changes: 2 additions & 6 deletions tests/test_randomforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ def test_tree_(self):
assert not hasattr(self.model, "trees_")

def test_fit(self):
try:
with pytest.raises(NotImplementedError):
self.model.fit(None, None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("RandomForestTemplate.fit expectedly refused call")

def test_predict(self):
try:
with pytest.raises(NotImplementedError):
self.model.predict(None) # type: ignore
except NotImplementedError as ex:
pytest.xfail("RandomForestTemplate.predict expectedly refused call")


class TestRandomForestRegressor:
Expand Down
24 changes: 12 additions & 12 deletions tests/test_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_check_y_and_target_groups(y, target_groups, is_bad):
scoring.check_y_and_target_groups(y, target_groups=target_groups)
except ValueError as ex:
if is_bad:
pytest.xfail("y and target_groups properly failed")
pass # y and target_groups properly failed
else:
raise ex
else:
Expand All @@ -51,7 +51,7 @@ def test_calc_variance(y: np.ndarray, target_groups: np.ndarray, variance_exp: f
variance = scoring.calc_variance(y, target_groups)
except ValueError as ex:
if variance_exp is None:
pytest.xfail("Properly raised error calculating the variance")
pass # "Properly raised error calculating the variance"
else:
raise ex
else:
Expand All @@ -74,7 +74,7 @@ def test_entropy(y: np.ndarray):
h = scoring.entropy(y)
except ValueError as ex:
if len(y) == 0:
pytest.xfail("entropy properly failed because of empty y")
pass # entropy properly failed because of empty y
else:
raise ex
else:
Expand All @@ -98,7 +98,7 @@ def test_entropy_rs(y: np.ndarray):
h = rs_entropy(y.tolist())
except ValueError as ex:
if len(y) == 0:
pytest.xfail("entropy properly failed because of empty y")
pass # entropy properly failed because of empty y
else:
raise ex
else:
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_calc_entropy(y: np.ndarray, target_groups: np.ndarray, h_exp: float):
h = scoring.calc_entropy(y, target_groups)
except ValueError as ex:
if h_exp is None:
pytest.xfail("Properly raised error calculating the entropy")
pass # Properly raised error calculating the entropy
else:
raise ex
else:
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_calc_entropy_rs(y: np.ndarray, target_groups: np.ndarray, h_exp: float)
h = scoring.calc_entropy_rs(y, target_groups)
except ValueError as ex:
if h_exp is None:
pytest.xfail("Properly raised error calculating the entropy")
pass # Properly raised error calculating the entropy
else:
raise ex
else:
Expand All @@ -178,7 +178,7 @@ def test_gini_impurity(y: np.ndarray):
g = scoring.gini_impurity(y)
except ValueError as ex:
if len(y) == 0:
pytest.xfail("gini_impurity properly failed because of empty y")
pass # gini_impurity properly failed because of empty y
else:
raise ex
else:
Expand All @@ -202,7 +202,7 @@ def test_gini_impurity_rs(y: np.ndarray):
g = rs_gini_impurity(y.tolist())
except ValueError as ex:
if len(y) == 0:
pytest.xfail("gini_impurity properly failed because of empty y")
pass # gini_impurity properly failed because of empty y
else:
raise ex
else:
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_calc_gini_impurity(y: np.ndarray, target_groups: np.ndarray, g_exp: flo
g = scoring.calc_gini_impurity(y, target_groups)
except ValueError as ex:
if g_exp is None:
pytest.xfail("Properly raised error calculating the gini impurity")
pass # Properly raised error calculating the gini impurity
else:
raise ex
else:
Expand Down Expand Up @@ -273,7 +273,7 @@ def test_calc_gini_impurity_rs(y: np.ndarray, target_groups: np.ndarray, g_exp:
g = scoring.calc_gini_impurity_rs(y, target_groups)
except ValueError as ex:
if g_exp is None:
pytest.xfail("Properly raised error calculating the gini impurity")
pass # Properly raised error calculating the gini impurity
else:
raise ex
else:
Expand All @@ -299,7 +299,7 @@ def test_xgboost_split_score(g: np.ndarray, h: np.ndarray, is_bad: bool):
score = scoring.xgboost_split_score(g, h, growth_params)
except ValueError as ex:
if is_bad:
pytest.xfail("xgboost_split_score properly failed because of empty g or h")
pass # xgboost_split_score properly failed because of empty g or h
else:
raise ex
else:
Expand Down Expand Up @@ -355,7 +355,7 @@ def test_calc_xgboost_split_score(
score = scoring.calc_xgboost_split_score(target_groups, g, h, growth_params)
except ValueError as ex:
if score_exp is None:
pytest.xfail("Properly raised error calculating the xgboost score")
pass # Properly raised error calculating the xgboost score
else:
raise ex
else:
Expand Down
Loading
Loading