File: regression_tests.py

package info (click to toggle)
python-pybedtools 0.10.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,620 kB
  • sloc: python: 10,030; cpp: 899; makefile: 142; sh: 57
file content (42 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (2)
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
"""
when bugs are identified post-release, put tests here to make sure they don't
happen again
"""

import pybedtools
import pybedtools.featurefuncs
import pybedtools.helpers


def test_midpoint():
    """
    regression test for #98
    """
    a = """chr1 3052874 3053149
    chr1 3333690 3333915
    chr1 3472838 3473382
    chr1 3639053 3639356
    """

    def nothing(f):
        return f

    input_bed = pybedtools.BedTool(a, from_string=True).saveas("test_input.bed")

    for func in [
        pybedtools.featurefuncs.midpoint,
        pybedtools.featurefuncs.center,
        nothing,
    ]:
        input_bed_mid = input_bed.each(func)
        assert len(input_bed_mid) == 4


# pysam is now handling bgzip
# def test_bgzip_missing():
#
#     old_path = pybedtools.settings._tabix_path
#     pybedtools.helpers.set_bgzip_path('somenonexistantpath')
#     a = pybedtools.example_bedtool('a.bed')
#     assert_raises(ValueError, a.tabix)
#     pybedtools.helpers.set_bgzip_path(old_path)