Exemple #1
0
 def test_mv_dir(self):
     "Should move a directory"
     p = Path(self.tdir)
     p.mkdir('somedir')
     pd = p + 'somedir'
     self.assertTrue(p.is_dir)
     p2 = p.mv(p.parent + 'some2')
     self.assertTrue(p2.is_dir)
     self.assertFalse(p.is_dir)
Exemple #2
0
 def test_mv_file(self):
     "Should move a file"
     p = Path(self.tdir) + 'some.txt'
     p << 'contents'
     self.assertTrue(p.is_file)
     p2 = p.mv(p.parent + 'some2.txt')
     self.assertTrue(p2.is_file)
     self.assertFalse(p.is_file)
     self.assertEqual('contents', open(p2).read())
Exemple #3
0
 def test_mv_dir(self):
     "Should move a directory"
     p = Path(self.tdir)
     p.mkdir('somedir')
     pd = p + 'somedir'
     self.assertTrue(p.is_dir)
     p2 = p.mv(p.parent + 'some2')
     self.assertTrue(p2.is_dir)
     self.assertFalse(p.is_dir)
Exemple #4
0
 def test_mv_file(self):
     "Should move a file"
     p = Path(self.tdir) + 'some.txt'
     p << 'contents'
     self.assertTrue(p.is_file)
     p2 = p.mv(p.parent + 'some2.txt')
     self.assertTrue(p2.is_file)
     self.assertFalse(p.is_file)
     self.assertEqual('contents', open(p2).read())
Exemple #5
0
 def test_mv_nonexistent(self):
     "Should raise"
     p = Path(self.tdir) + 'nonexistant'
     with self.assertRaises(exceptions.DoesNotExistError):
         p.mv(self.tdir)
Exemple #6
0
 def test_mv_nonexistent(self):
     "Should raise"
     p = Path(self.tdir) + 'nonexistant'
     with self.assertRaises(exceptions.DoesNotExistError):
         p.mv(self.tdir)