Skip to content

Commit d7fccfa

Browse files
committed
Add test of misuse of wrap function
1 parent 42fd264 commit d7fccfa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/miscellaneous/abstract_trees_test.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,23 @@ end
8181
traverse_tree(leaf::InfoLeaf) = nothing
8282

8383
traverse_tree(wrapped_tree)
84+
end
85+
86+
@testset "abstract_trees - test misuse" begin
87+
88+
@info("Test misuse of `classlabel` information")
89+
90+
@info("Create test data - a decision tree based on the iris data set")
91+
features, labels = load_data("iris")
92+
features = float.(features)
93+
labels = string.(labels)
94+
model = DecisionTreeClassifier()
95+
fit!(model, features, labels)
96+
97+
@info("Try to replace the exisitng class labels")
98+
class_labels = unique(labels)
99+
dtree = model.root.node
100+
wt = DecisionTree.wrap(dtree, (classlabels = class_labels,))
101+
@test_throws AssertionError AbstractTrees.print_tree(wt)
102+
84103
end

0 commit comments

Comments
 (0)