Exemplo 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)
Exemplo 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)
Exemplo 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()])
Exemplo n.º 4
0
def test_nopen_raises():
    try:
        next(nopen("|asdfasdfasdfasdfasdf"))
    except StopIteration:
        raise ProcessException
Exemplo n.º 5
0
def check_nopen(fname):
    d = nopen(fname)
    assert hasattr(d, "__iter__")
Exemplo 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()
    ])
Exemplo n.º 7
0
def test_nopen_raises():
    next(nopen("|asdfasdfasdfasdfasdf"))
Exemplo n.º 8
0
def check_nopen(fname):
    d = nopen(fname)
    assert hasattr(d, "__iter__")
Exemplo n.º 9
0
def test_nopen_raises():
    next(nopen("|asdfasdfasdfasdfasdf"))
Exemplo n.º 10
0
def test_nopen_raises():
    try:
        next(nopen("|asdfasdfasdfasdfasdf"))
    except StopIteration:
        raise ProcessException