@@ -76,7 +76,6 @@ def test_search_empty_word(self, word):
7676 search (docs , word )
7777 } '''
7878
79-
8079 def test_search_word_with_punctuation (self ):
8180 """
8281 Test that the search word can be with puntcuation
@@ -89,7 +88,7 @@ def test_search_word_with_punctuation(self):
8988
9089 assert search (docs , 'pint' ) == ['doc1' ]
9190 assert search (docs , 'pint!' ) == ['doc1' ]
92-
91+
9392 def test_search_ranging (self ):
9493 """
9594 Test that the search function returns results
@@ -117,9 +116,9 @@ def test_search_multiple_words(self):
117116
118117 The test ensures the following:
119118 - The search can handle multiple words (i.e., 'shoot at me').
120- - Documents are returned in the order of their relevance
119+ - Documents are returned in the order of their relevance
121120 (based on word frequency).
122- - Words in the search query are treated independently
121+ - Words in the search query are treated independently
123122 (i.e., not as a single phrase).
124123 """
125124 doc1 = "I can't shoot straight unless I've had a pint!"
@@ -135,7 +134,6 @@ def test_search_multiple_words(self):
135134 result = search (docs , 'shoot at me' )
136135 assert result == ['doc2' , 'doc1' ]
137136
138-
139137 def test_get_inverted_index (self ):
140138 doc1 = {'id' : 'doc1' , 'text' : 'some text' }
141139 doc2 = {'id' : 'doc2' , 'text' : 'some text too' }
@@ -146,5 +144,5 @@ def test_get_inverted_index(self):
146144 'text' : ['doc1' , 'doc2' ],
147145 'too' : ['doc2' ]
148146 }
149-
147+
150148 assert get_inverted_index (docs ) == index
0 commit comments