def test_readables_from_paths_file(tmpdir): wexin = tmpdir.join('0.wexin') with wexin.open('w') as fp: fp.write('foo') data = [] for readable in readables_from_paths([wexin.strpath]): data.append(read_chunks(readable)) assert data == [b'foo']
def test_readables_from_paths_dir(tmpdir): dir1 = tmpdir.mkdir('dir1') wexin = dir1.join('0.wexin') with wexin.open('w') as fp: fp.write('foo') data = [] for readable in readables_from_paths([tmpdir.strpath]): data.append(read_chunks(readable)) assert data == [b'foo']
def test_readables_from_paths_url(): data = [] for readable in readables_from_paths(['http://httpbin.org/headers']): data.append(read_chunks(readable)) assert data[0].startswith(b'HTTP/1.1 200 OK')