예제 #1
0
 def test_readline(self):
     it = ['hello ', 'world!', '\ngoodbye world!', '']
     iterfile = IterFile(it)
     assert iterfile.readline() == 'hello world!\n'
     assert iterfile.readline() == 'goodbye world!'
     assert iterfile.readline() == ''
     assert iterfile.read() == ''
예제 #2
0
 def test_close(self):
     it = ['hello ', 'world!', '\ngoodbye world!', '']
     iterfile = IterFile(it)
     assert iterfile.readline() == 'hello world!\n'
     iterfile.close()
     self.assertRaises(IOError, iterfile.read)
     self.assertRaises(IOError, iterfile.readline)
     self.assertRaises(IOError, iterfile.readlines)
     self.assertRaises(IOError, iter(iterfile).next)
     iterfile.close()