Back to index

python3.2  3.2.2
Public Member Functions
test.test_fileinput.FileInputTests Class Reference

List of all members.

Public Member Functions

def test_zero_byte_files
def test_files_that_dont_end_with_newline

Detailed Description

Definition at line 124 of file test_fileinput.py.


Member Function Documentation

Definition at line 149 of file test_fileinput.py.

00149 
00150     def test_files_that_dont_end_with_newline(self):
00151         t1 = t2 = None
00152         try:
00153             t1 = writeTmp(1, ["A\nB\nC"])
00154             t2 = writeTmp(2, ["D\nE\nF"])
00155             fi = FileInput(files=(t1, t2))
00156             lines = list(fi)
00157             self.assertEqual(lines, ["A\n", "B\n", "C", "D\n", "E\n", "F"])
00158             self.assertEqual(fi.filelineno(), 3)
00159             self.assertEqual(fi.lineno(), 6)
00160         finally:
00161             remove_tempfiles(t1, t2)

Here is the call graph for this function:

Definition at line 125 of file test_fileinput.py.

00125 
00126     def test_zero_byte_files(self):
00127         t1 = t2 = t3 = t4 = None
00128         try:
00129             t1 = writeTmp(1, [""])
00130             t2 = writeTmp(2, [""])
00131             t3 = writeTmp(3, ["The only line there is.\n"])
00132             t4 = writeTmp(4, [""])
00133             fi = FileInput(files=(t1, t2, t3, t4))
00134 
00135             line = fi.readline()
00136             self.assertEqual(line, 'The only line there is.\n')
00137             self.assertEqual(fi.lineno(), 1)
00138             self.assertEqual(fi.filelineno(), 1)
00139             self.assertEqual(fi.filename(), t3)
00140 
00141             line = fi.readline()
00142             self.assertFalse(line)
00143             self.assertEqual(fi.lineno(), 1)
00144             self.assertEqual(fi.filelineno(), 0)
00145             self.assertEqual(fi.filename(), t4)
00146             fi.close()
00147         finally:
00148             remove_tempfiles(t1, t2, t3, t4)

Here is the call graph for this function:


The documentation for this class was generated from the following file: