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)
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()])
def test_nopen_raises(): try: next(nopen("|asdfasdfasdfasdfasdf")) except StopIteration: raise ProcessException
def check_nopen(fname): d = nopen(fname) assert hasattr(d, "__iter__")
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() ])
def test_nopen_raises(): next(nopen("|asdfasdfasdfasdfasdf"))