File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -196,9 +196,11 @@ def print_tree(self, height: int = 0) -> None:
196
196
for value in self .nodes .values ():
197
197
value .print_tree (height + 1 )
198
198
199
+
199
200
## write unit test for the code using unittest library with logic similar to test_trie() function
200
201
## and call it from main()
201
202
203
+
202
204
class TestRadixNode (unittest .TestCase ):
203
205
def test_trie (self ) -> None :
204
206
words = "banana bananas bandana band apple all beast" .split ()
@@ -215,10 +217,10 @@ def test_trie(self) -> None:
215
217
assert root .find ("bananas" )
216
218
217
219
def test_trie_2 (self ) -> None :
218
- '''
219
- now add a new test case which inserts
220
+ """
221
+ now add a new test case which inserts
220
222
foobbb, fooaaa, foo in the given order and checks for different assertions
221
- '''
223
+ """
222
224
words = "foobbb fooaaa foo" .split ()
223
225
root = RadixNode ()
224
226
root .insert_many (words )
@@ -229,5 +231,6 @@ def test_trie_2(self) -> None:
229
231
assert root .find ("foobbb" )
230
232
assert root .find ("fooaaa" )
231
233
234
+
232
235
if __name__ == "__main__" :
233
236
unittest .main ()
You can’t perform that action at this time.
0 commit comments