def test_get_repeated_completions(self): tree = TernarySearchTree() tree.add('An aaaaaaaaa') tree.add('An aaaaaaaab') completions = tree.get_completions('An aa') expected = set(['An aaaaaaaaa', 'An aaaaaaaab']) self.assertEqual(set(completions), expected)
def test_get_repeated_completions(self): tree = TernarySearchTree() tree.add("An aaaaaaaaa") tree.add("An aaaaaaaab") completions = tree.get_completions("An aa") expected = set(["An aaaaaaaaa", "An aaaaaaaab"]) self.assertEqual(set(completions), expected)
def test_get_completions(self): tree = TernarySearchTree() tree.add("An aapple fell off the tree") tree.add("An aardvark fell off the tree") completions = tree.get_completions("An aa") expected = set(["An aapple fell off the tree", "An aardvark fell off the tree"]) self.assertEqual(set(completions), expected)
def test_get_completions(self): tree = TernarySearchTree() tree.add('An aapple fell off the tree') tree.add('An aardvark fell off the tree') completions = tree.get_completions('An aa') expected = set( ['An aapple fell off the tree', 'An aardvark fell off the tree']) self.assertEqual(set(completions), expected)
def test_get_completions_words(self): tree = TernarySearchTree() sentences = [ "An aapple fell off the tree", "An aardvark fell off the tree", "asdf", "asdf airplane asdfpppwpi gjas", ] for sentence in sentences: for word in sentence.split(): tree.add(word) completions = tree.get_completions("a") expected = set(["aapple", "aardvark", "asdfpppwpi", "airplane", "asdf"]) self.assertEqual(set(completions), expected)
def test_get_completions_words(self): tree = TernarySearchTree() sentences = [ 'An aapple fell off the tree', 'An aardvark fell off the tree', 'asdf', 'asdf airplane asdfpppwpi gjas', ] for sentence in sentences: for word in sentence.split(): tree.add(word) completions = tree.get_completions('a') expected = set( ['aapple', 'aardvark', 'asdfpppwpi', 'airplane', 'asdf']) self.assertEqual(set(completions), expected)