File: compile_test.py

package info (click to toggle)
python-pysam 0.10.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,196 kB
  • ctags: 10,087
  • sloc: ansic: 79,627; python: 8,569; sh: 282; makefile: 215; perl: 41
file content (46 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'''
compile_test.py - check pyximport
=================================

test script for checking if compilation against
pysam and tabix works.
'''
# clean up previous compilation
import os
try:
    os.unlink('_compile_test.c')
    os.unlink('_compile_test.pyxbldc')
except OSError:
    pass


import pyximport
pyximport.install(build_in_temp=False)
import _compile_test

import unittest
import pysam


class BAMTest(unittest.TestCase):

    input_filename = "pysam_data/ex1.bam"

    def testCount(self):

        nread = _compile_test.testCountBAM(
            pysam.Samfile(self.input_filename))
        self.assertEqual(nread, 3270)


class GTFTest(unittest.TestCase):

    input_filename = "tabix_data/example.gtf.gz"

    def testCount(self):
        nread = _compile_test.testCountGTF(
            pysam.Tabixfile(self.input_filename))
        self.assertEqual(nread, 237)

if __name__ == "__main__":
    unittest.main()