예제 #1
0
 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'])
예제 #2
0
파일: testbuiltin.py 프로젝트: chaosim/dao
 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'])
예제 #3
0
파일: testbuiltin.py 프로젝트: chaosim/dao
 def test_write(self):
   file1 = Var('file1')
   eq_(eval(let([(file1, open_file('test2.txt', 'w'))], 
                write(file1, 'test'), close_file(file1))), None)
예제 #4
0
파일: testbuiltin.py 프로젝트: chaosim/dao
 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')
예제 #5
0
 def test_write(self):
     file1 = Var('file1')
     eq_(
         eval(
             let([(file1, open_file('test2.txt', 'w'))],
                 write(file1, 'test'), close_file(file1))), None)
예제 #6
0
 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')