From bc976017307136f3daf98424d399761af29e8091 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Sat, 2 Dec 2023 14:48:18 -0800 Subject: [PATCH] add more coverage to bm25 --- tests/unit/encoders/test_bm25.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/unit/encoders/test_bm25.py b/tests/unit/encoders/test_bm25.py index e0f6dad5..c1987151 100644 --- a/tests/unit/encoders/test_bm25.py +++ b/tests/unit/encoders/test_bm25.py @@ -22,3 +22,14 @@ class TestBM25Encoder: assert all( isinstance(sublist, list) for sublist in result ), "Each item in result should be a list" + + def test_call_method_no_docs(self, bm25_encoder): + with pytest.raises(ValueError): + bm25_encoder([]) + + def test_call_method_no_word(self, bm25_encoder): + result = bm25_encoder(["doc with fake word gta5jabcxyz"]) + assert isinstance(result, list), "Result should be a list" + assert all( + isinstance(sublist, list) for sublist in result + ), "Each item in result should be a list" -- GitLab