Example #1
0
    def test_read_lines(self):
        with TempDirectory() as input_file:
            input_file.write("A.tmp", b"1\n2\n3")
            reader = FileReader(os.path.join(input_file.path, "A.tmp"))
            reader.open()
            actual_lines = [line for line in reader.read_lines()]
            reader.close()

            self.assertEquals(["1\n", "2\n", "3"], actual_lines)
Example #2
0
    def test_read_lines(self):
        with TempDirectory() as input_file:
            input_file.write("A.tmp", b"1\n2\n3")
            reader = FileReader(os.path.join(input_file.path, "A.tmp"))
            reader.open()
            actual_lines = [line for line in reader.read_lines()]
            reader.close()

            self.assertEquals(["1\n", "2\n", "3"], actual_lines)
Example #3
0
 def test_read_lines_raisesTypeErrorWhenClosed(self):
     with TempDirectory() as input_file:
         input_file.write("A.tmp", b"1\n2\n3")
         reader = FileReader(os.path.join(input_file.path, "A.tmp"))
         line_iter = reader.read_lines()
         self.assertRaises(TypeError, next, line_iter)
Example #4
0
 def test_read_lines_raisesTypeErrorWhenClosed(self):
     with TempDirectory() as input_file:
         input_file.write("A.tmp", b"1\n2\n3")
         reader = FileReader(os.path.join(input_file.path, "A.tmp"))
         line_iter = reader.read_lines()
         self.assertRaises(TypeError, next, line_iter)