예제 #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()
예제 #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()
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #8
0
 def test_lsfile(self):
     "Just returns the name"
     p = Path(self.tmpath)
     self.assertEqual(self.tmpath, p.ls())
예제 #9
0
 def test_ls(self):
     "Should list dir contents"
     p = Path(self.tdir)
     self.assertEqual([], p.ls())
예제 #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)
예제 #11
0
 def test_lsfile(self):
     "Just returns the name"
     p = Path(self.tmpath)
     self.assertEqual(self.tmpath, p.ls())
예제 #12
0
 def test_ls(self):
     "Should list dir contents"
     p = Path(self.tdir)
     self.assertEqual([], p.ls())