Permalink
Browse files

Revert e19c029 trie changes.

The trie object is written in C and doesn't (yet) support 'in',
so we still have to use has_key for now.
  • Loading branch information...
1 parent 8668911 commit 0606a23672dcd4be6801412a5ec50fa420633545 @peterjc peterjc committed Dec 3, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 Bio/triefind.py
  2. +3 −3 Tests/test_trie.py
View
4 Bio/triefind.py
@@ -26,7 +26,7 @@ def match(string, trie):
substr = string[:i+1]
if not trie.has_prefix(substr):
break
- if substr in trie:
+ if trie.has_key(substr):
longest = substr
return longest
@@ -42,7 +42,7 @@ def match_all(string, trie):
substr = string[:i+1]
if not trie.has_prefix(substr):
break
- if substr in trie:
+ if trie.has_key(substr):
matches.append(substr)
return matches
View
6 Tests/test_trie.py
@@ -48,9 +48,9 @@ def test_prefix(self):
self.assertEqual(k, ["foo", "he", "hej", "hello"])
self.assertEqual(trieobj["hello"], 5)
self.assertEqual(trieobj.get("bye"), None)
- self.assertTrue("hello" in trieobj)
- self.assertTrue("he" in trieobj)
- self.assertFalse("bye" in trieobj)
+ self.assertEqual(trieobj.has_key("hello"), True)
+ self.assertEqual(trieobj.has_key("he"), True)
+ self.assertEqual(trieobj.has_key("bye"), False)
self.assertEqual(trieobj.has_prefix("h"), True)
self.assertEqual(trieobj.has_prefix("hel"), True)
self.assertEqual(trieobj.has_prefix("foa"), False)

0 comments on commit 0606a23

Please sign in to comment.