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