Esempio n. 1
0
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']
Esempio n. 2
0
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)
Esempio n. 3
0
def test_discover():
    assert discover(TextFile('')) == dshape('var * string')
Esempio n. 4
0
def test_convert():
    with filetext('Hello\nWorld') as fn:
        assert convert(list, TextFile(fn)) == ['Hello\n', 'World']