1 | """ |
---|
2 | Tests for `bx.seq.qdna`. |
---|
3 | """ |
---|
4 | |
---|
5 | import unittest |
---|
6 | import sys |
---|
7 | import os.path |
---|
8 | import qdna |
---|
9 | |
---|
10 | test_qdna = "test_data/seq_tests/test.qdna" |
---|
11 | |
---|
12 | # Same sequence data as stored in test.qdna |
---|
13 | |
---|
14 | valid_seq = "C7wMwHQrMKqEtSREuUv5nsLinpTS8l7jXpbI7IipvCbHnhOdgx" \ |
---|
15 | + "5tzRgzYl4j85d:xSlvKPEKEIvZkfiX1YPkBi1Ibhfn9fTZd8gG" \ |
---|
16 | + "Wy284hJnwf93W4eHOjeRk7LuVYmH{UTYkYM:b4J4MruMq1ihhv" \ |
---|
17 | + "1Yl5W[xXEmi8[JuuLRgooBpy23PllMuUiIiKVIK5vzhjPPYp5Y" \ |
---|
18 | + "1eqPxo[e5I24KeCdTV94MZWNybUb:McC:1n4Jczk8JqnR4q1gY" \ |
---|
19 | + "HjLS4Bes3s5YvvWdKzS4VrFZy2erhd7YoWRoS[UK8JtSp1{Z1o" \ |
---|
20 | + "5:TpvN8mrmWrghiNw{S6nT8DSfF{1ff6kNGpI:FsZE2RgipTVO" \ |
---|
21 | + "mJN6vPm8MUgNYd7MDBEu37YOPzPjO1dr" |
---|
22 | |
---|
23 | valid_seq_len = len(valid_seq) |
---|
24 | |
---|
25 | class QDNATestCase(unittest.TestCase): |
---|
26 | |
---|
27 | def test_get(self): |
---|
28 | qdnafile = qdna.QdnaFile(file(test_qdna,"rb")) |
---|
29 | check_get(qdnafile, 0, valid_seq_len) |
---|
30 | check_get(qdnafile, 0, 40) |
---|
31 | check_get(qdnafile, valid_seq_len - 40, 40) |
---|
32 | |
---|
33 | def check_get(qdnafile, start, len): |
---|
34 | assert qdnafile.get(start, len) == valid_seq[start:start+len] |
---|
35 | |
---|
36 | test_classes = [ QDNATestCase ] |
---|
37 | suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] ) |
---|