def test_open_read2(self): file1 = Var('file1') x = Var('x') eq_( eval( let([(file1, open_file('test.txt'))], readline(file1), assign(x, readlines(file1)), close_file(file1), x)), ['hello'])
def test_open_read2(self): file1 = Var('file1') x = Var('x') eq_(eval(let([(file1, open_file('test.txt'))], readline(file1), assign(x, readlines(file1)), close_file(file1), x)), ['hello'])
def test_write(self): file1 = Var('file1') eq_(eval(let([(file1, open_file('test2.txt', 'w'))], write(file1, 'test'), close_file(file1))), None)
def test_open_read(self): file1 = Var('file1') eq_(eval(let([(file1, open_file('test.txt'))], assign(x, read(file1)), close_file(file1), x)), 'hello\nhello')
def test_write(self): file1 = Var('file1') eq_( eval( let([(file1, open_file('test2.txt', 'w'))], write(file1, 'test'), close_file(file1))), None)
def test_open_read(self): file1 = Var('file1') eq_( eval( let([(file1, open_file('test.txt'))], assign(x, read(file1)), close_file(file1), x)), 'hello\nhello')