コード例 #1
0
ファイル: test_path.py プロジェクト: davidmiller/ffs
 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())
コード例 #2
0
ファイル: test_path.py プロジェクト: pombredanne/ffs-1
 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())
コード例 #3
0
ファイル: test_path.py プロジェクト: davidmiller/ffs
 def test_readline_nofile(self):
     "Should raise"
     p = Path(tempfile.mktemp())
     with self.assertRaises(TypeError):
         p.readline()
コード例 #4
0
ファイル: test_path.py プロジェクト: davidmiller/ffs
 def test_readline_dir(self):
     "Should raise"
     p = Path(self.tdir)
     with self.assertRaises(TypeError):
         p.readline()
コード例 #5
0
ファイル: test_path.py プロジェクト: pombredanne/ffs-1
 def test_readline_nofile(self):
     "Should raise"
     p = Path(tempfile.mktemp())
     with self.assertRaises(TypeError):
         p.readline()
コード例 #6
0
ファイル: test_path.py プロジェクト: pombredanne/ffs-1
 def test_readline_dir(self):
     "Should raise"
     p = Path(self.tdir)
     with self.assertRaises(TypeError):
         p.readline()