Ejemplo n.º 1
0
 def test_readline(self):
     "Should ducktype as a file and readline()"
     nopath = tempfile.mkdtemp()
     p = Path(nopath) + 'testfile.txt'
     p << "Frist\nNext\nLast"
     self.assertEqual("Frist\n", p.readline())
     self.assertEqual("Next\n", p.readline())
     self.assertEqual("Last", p.readline())
     self.assertEqual("", p.readline())
Ejemplo n.º 2
0
 def test_readline(self):
     "Should ducktype as a file and readline()"
     nopath = tempfile.mkdtemp()
     p = Path(nopath) + 'testfile.txt'
     p << "Frist\nNext\nLast"
     self.assertEqual("Frist\n", p.readline())
     self.assertEqual("Next\n", p.readline())
     self.assertEqual("Last", p.readline())
     self.assertEqual("", p.readline())
Ejemplo n.º 3
0
 def test_readline_nofile(self):
     "Should raise"
     p = Path(tempfile.mktemp())
     with self.assertRaises(TypeError):
         p.readline()
Ejemplo n.º 4
0
 def test_readline_dir(self):
     "Should raise"
     p = Path(self.tdir)
     with self.assertRaises(TypeError):
         p.readline()
Ejemplo n.º 5
0
 def test_readline_nofile(self):
     "Should raise"
     p = Path(tempfile.mktemp())
     with self.assertRaises(TypeError):
         p.readline()
Ejemplo n.º 6
0
 def test_readline_dir(self):
     "Should raise"
     p = Path(self.tdir)
     with self.assertRaises(TypeError):
         p.readline()