Question
The code should be in Python Write unittests for search and match functions written in class. `Empty string as a query Empty document collection Tests
The code should be in Python
Write unittests for search and match functions written in class.
`Empty string as a query
Empty document collection
Tests that differentiate string matching and Boolean term matching (i.e. the same inputs should return different outputs for different matching functions).
Test where string matching returns True, but you would not expect search to return the document.
More specifically, for search, you already have a test that includes both matching and non-matching documents. You should add
A test with an empty query
A test with an empty document list
For string_match, you already have a test for a match case, non-match case, and a partial word match case. You should add
A test with an empty query
A test with an empty document list
A test with a document matching a multi-word query
A test of string_match with a query-document pair where boolean_term_match function would return True, but string_match returns False
For boolean_term_match you should add tests for all the same inputs as you'll have for string_match (7 test functions).
In total you need to add 13 test cases (test functions) across all 3 functions under test (search, string_match, and boolean_term_match).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started