Esempio n. 1
0
def test_callable_header():
    class Bed(object):
        def __init__(self, toks):
            self.chrom = toks[0]
            self.start = int(toks[1])
            self.end = int(toks[2])

    fh = nopen(op.join(DATA, "file_data.txt"))
    fh.readline()  # drop header.
    for bed in reader(fh, header=Bed):
        assert bed.chrom
        assert isinstance(bed.start, int)
Esempio n. 2
0
def test_callable_header():

    class Bed(object):
        def __init__(self, toks):
            self.chrom = toks[0]
            self.start = int(toks[1])
            self.end = int(toks[2])

    fh = nopen(op.join(DATA, "file_data.txt"))
    fh.readline() # drop header.
    for bed in reader(fh, header=Bed):
        assert bed.chrom
        assert isinstance(bed.start, int)
Esempio n. 3
0
def test_process_subst():
    assert not len([x for x in nopen("|cat <(less %s)") if x.strip()])
    assert len([x for x in nopen("|cat <(less %s)" % __file__.rstrip('c')) if x.strip()])
Esempio n. 4
0
def test_nopen_raises():
    try:
        next(nopen("|asdfasdfasdfasdfasdf"))
    except StopIteration:
        raise ProcessException
Esempio n. 5
0
def check_nopen(fname):
    d = nopen(fname)
    assert hasattr(d, "__iter__")
Esempio n. 6
0
def test_process_subst():
    assert not len([x for x in nopen("|cat <(less %s)") if x.strip()])
    assert len([
        x for x in nopen("|cat <(less %s)" % __file__.rstrip('c'))
        if x.strip()
    ])
Esempio n. 7
0
def test_nopen_raises():
    next(nopen("|asdfasdfasdfasdfasdf"))
Esempio n. 8
0
def check_nopen(fname):
    d = nopen(fname)
    assert hasattr(d, "__iter__")
Esempio n. 9
0
def test_nopen_raises():
    next(nopen("|asdfasdfasdfasdfasdf"))
Esempio n. 10
0
def test_nopen_raises():
    try:
        next(nopen("|asdfasdfasdfasdfasdf"))
    except StopIteration:
        raise ProcessException