Exemple #1
0
 def test_ls_nonexistant(self):
     "Should raise if we don't exist"
     nopath = tempfile.mkdtemp()
     rmdir(nopath)
     p = Path(nopath)
     with self.assertRaises(exceptions.DoesNotExistError):
         p.ls()
Exemple #2
0
 def test_ls_nonexistant(self):
     "Should raise if we don't exist"
     nopath = tempfile.mkdtemp()
     rmdir(nopath)
     p = Path(nopath)
     with self.assertRaises(exceptions.DoesNotExistError):
         p.ls()
Exemple #3
0
 def test_ls_glob(self):
     "only return the globbed contents"
     p = Path(self.tdir)
     p.touch('one.txt', 'two.txt', 'three.csv')
     contents = p.ls('*.txt')
     self.assertEqual(2, len(contents))
     self.assertTrue(all([isinstance(i, Path) for i in contents]))
     for p in [self.tdir + '/one.txt', self.tdir + '/two.txt']:
         self.assertIn(p, contents)
Exemple #4
0
 def test_ls_ispath(self):
     "Should return a list of paths"
     p = Path(self.tdir)
     p.touch('one.txt', 'two.txt')
     contents = p.ls()
     self.assertEqual(2, len(contents))
     self.assertTrue(all([isinstance(i, Path) for i in contents]))
     for p in [self.tdir + '/one.txt', self.tdir + '/two.txt']:
         self.assertIn(p, contents)
Exemple #5
0
 def test_ls_glob(self):
     "only return the globbed contents"
     p = Path(self.tdir)
     p.touch('one.txt', 'two.txt', 'three.csv')
     contents = p.ls('*.txt')
     self.assertEqual(2, len(contents))
     self.assertTrue(all([isinstance(i, Path) for i in contents]))
     for p in [self.tdir + '/one.txt', self.tdir + '/two.txt']:
         self.assertIn(p, contents)
Exemple #6
0
 def test_ls_ispath(self):
     "Should return a list of paths"
     p = Path(self.tdir)
     p.touch('one.txt', 'two.txt')
     contents = p.ls()
     self.assertEqual(2, len(contents))
     self.assertTrue(all([isinstance(i, Path) for i in contents]))
     for p in [self.tdir + '/one.txt', self.tdir + '/two.txt']:
         self.assertIn(p, contents)
Exemple #7
0
 def test_ls_returns_dir(self):
     "Should return a dictionary"
     p = Path(self.tdir)
     p.touch('one.txt', 'two.txt')
     contents = p.ls()
     self.assertIsInstance(contents, Pset)
Exemple #8
0
 def test_lsfile(self):
     "Just returns the name"
     p = Path(self.tmpath)
     self.assertEqual(self.tmpath, p.ls())
Exemple #9
0
 def test_ls(self):
     "Should list dir contents"
     p = Path(self.tdir)
     self.assertEqual([], p.ls())
Exemple #10
0
 def test_ls_returns_dir(self):
     "Should return a dictionary"
     p = Path(self.tdir)
     p.touch('one.txt', 'two.txt')
     contents = p.ls()
     self.assertIsInstance(contents, Pset)
Exemple #11
0
 def test_lsfile(self):
     "Just returns the name"
     p = Path(self.tmpath)
     self.assertEqual(self.tmpath, p.ls())
Exemple #12
0
 def test_ls(self):
     "Should list dir contents"
     p = Path(self.tdir)
     self.assertEqual([], p.ls())