Skip to content

Commit edaa61a

Browse files
committed
Added test for missing keys
1 parent ea9ae02 commit edaa61a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/booster_test.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_feature_importance_bad_importance_type
3030
assert_includes error.message, "Unknown importance type"
3131
end
3232

33-
def test_predict_with_hash_builds_sorted_input
33+
def test_predict_hash
3434
pred = booster.predict({x0: 3.7, x1: 1.2, x2: 7.2, x3: 9.0})
3535
assert_in_delta 0.9823112229173586, pred
3636

@@ -44,6 +44,10 @@ def test_predict_with_hash_builds_sorted_input
4444
]
4545
)
4646
assert_elements_in_delta [0.9823112229173586, 0.9583143724610858], pred.first(2)
47+
48+
assert_raises(KeyError) do
49+
booster.predict({"x0" => 3.7})
50+
end
4751
end
4852

4953
def test_model_to_string

0 commit comments

Comments
 (0)