Skip to content

Commit

Permalink
Fixed in operator in automata.py
Browse files Browse the repository at this point in the history
  • Loading branch information
TomsonBoylett committed Jan 25, 2021
1 parent 8535dcb commit 9c02bf6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lexpy/_base/automata.py
Expand Up @@ -40,6 +40,8 @@ def __contains__(self, word):
node = node[letter]
if node.eow and i == len(word) - 1:
return True
else:
return False
return False

def __contains_prefix(self, prefix):
Expand Down
8 changes: 7 additions & 1 deletion lexpy/tests/test_dawg.py
Expand Up @@ -35,11 +35,17 @@ def test_word_in_dawg(self):
self.dawg.reduce()
self.assertTrue('ash' in self.dawg, "Word should be in dawg")

def test_word_not_int_dawg(self):
def test_word_not_int_dawg1(self):
self.dawg = DAWG()
self.dawg.add_all(['ash', 'ashley'])
self.dawg.reduce()
self.assertFalse('salary' in self.dawg, "Word should not be in dawg")

def test_word_not_int_dawg2(self):
self.dawg = DAWG()
self.dawg.add_all(['ash', 'ashley'])
self.dawg.reduce()
self.assertFalse('mash lolley' in self.dawg, "Word should not be in dawg")

class TesDAWGWordInsert(unittest.TestCase):

Expand Down
7 changes: 6 additions & 1 deletion lexpy/tests/test_trie.py
Expand Up @@ -33,11 +33,16 @@ def test_word_in_trie(self):
self.trie.add_all(['ash', 'ashley'])
self.assertTrue('ash' in self.trie, "Word should be in trie")

def test_word_not_int_trie(self):
def test_word_not_int_trie1(self):
self.trie = Trie()
self.trie.add_all(['ash', 'ashley'])
self.assertFalse('salary' in self.trie, "Word should not be in trie")

def test_word_not_int_trie2(self):
self.trie = Trie()
self.trie.add_all(['ash', 'ashley'])
self.assertFalse('mash lolley' in self.trie, "Word should not be in trie")


class TesTrieWordInsert(unittest.TestCase):

Expand Down

0 comments on commit 9c02bf6

Please sign in to comment.