def test_append(): with tmpfile('log') as fn: t = TextFile(fn) append(t, ['Hello', 'World']) assert os.path.exists(fn) with open(fn) as f: assert list(map(str.strip, f.readlines())) == ['Hello', 'World']
def test_drop(): with filetext('hello\nworld') as fn: t = TextFile(fn) assert os.path.exists(fn) drop(t) assert not os.path.exists(fn)
def test_discover(): assert discover(TextFile('')) == dshape('var * string')
def test_convert(): with filetext('Hello\nWorld') as fn: assert convert(list, TextFile(fn)) == ['Hello\n', 'World']