Back to index

python-biopython  1.60
Public Member Functions
test_trie.TestTrieFind Class Reference

List of all members.

Public Member Functions

def test_find

Detailed Description

Definition at line 119 of file test_trie.py.


Member Function Documentation

Definition at line 121 of file test_trie.py.

00121 
00122     def test_find(self):
00123         from Bio import triefind
00124         trieobj = trie.trie()
00125         trieobj["hello"] = 5
00126         trieobj["he"] = 7
00127         trieobj["hej"] = 9
00128         trieobj["foo"] = "bar"
00129         trieobj["wor"] = "ld"
00130         self.assertEqual(triefind.match("hello world!", trieobj), "hello")
00131         k = triefind.match_all("hello world!", trieobj)
00132         k.sort()
00133         self.assertEqual(k, ["he", "hello"])
00134         k = triefind.find("hello world!", trieobj)
00135         k.sort()
00136         self.assertEqual(k, [("he", 0, 2), ("hello", 0, 5), ("wor", 6, 9)])
00137         k = triefind.find_words("hello world!", trieobj)
00138         k.sort()
00139         self.assertEqual(k, [("hello", 0, 5)])
00140         trieobj["world"] = "full"
00141         k = triefind.find("hello world!", trieobj)
00142         k.sort()
00143         self.assertEqual(k, [("he", 0, 2), ("hello", 0, 5), ("wor", 6, 9), ("world", 6, 11)])
00144         k = triefind.find_words("hello world!", trieobj)
00145         k.sort()
00146         self.assertEqual(k, [("hello", 0, 5), ("world", 6, 11)])
00147 


The documentation for this class was generated from the following file: