def test_touch_child(self): "Touch children" p = Path(self.tdir) self.assertFalse(os.path.isfile(self.tdir + 'one.txt')) self.assertFalse(os.path.isfile(self.tdir + 'two.txt')) p.touch('one.txt', 'two.txt') self.assertTrue(os.path.isfile(self.tdir + '/one.txt')) self.assertTrue(os.path.isfile(self.tdir + '/two.txt'))
def test_touch_child(self): "Touch children" p = Path(self.tdir) self.assertFalse(os.path.isfile(self.tdir + 'one.txt')) self.assertFalse(os.path.isfile(self.tdir + 'two.txt')) p.touch('one.txt', 'two.txt') self.assertTrue(os.path.isfile(self.tdir + '/one.txt')) self.assertTrue(os.path.isfile(self.tdir + '/two.txt'))
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_touch_child_tree(self): "Should imply the tree" p = Path(self.tdir) p.touch('that/theother.txt') self.assertTrue(os.path.isfile(self.tdir + '/that/theother.txt'))
def test_touch_child_no_self(self): "Should imply self" p = Path(self.tdir) + 'that' p.touch('theother.txt') self.assertTrue(os.path.isfile(self.tdir + '/that/theother.txt'))
def test_touch(self): "Should touch it" p = Path(self.tdir) + 'notyet.txt' self.assertFalse(os.path.isfile(str(p))) p.touch() self.assertTrue(os.path.isfile(str(p)))
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_touch_child_tree(self): "Should imply the tree" p = Path(self.tdir) p.touch('that/theother.txt') self.assertTrue(os.path.isfile(self.tdir + '/that/theother.txt'))
def test_touch_child_no_self(self): "Should imply self" p = Path(self.tdir) + 'that' p.touch('theother.txt') self.assertTrue(os.path.isfile(self.tdir + '/that/theother.txt'))
def test_touch(self): "Should touch it" p = Path(self.tdir) + 'notyet.txt' self.assertFalse(os.path.isfile(str(p))) p.touch() self.assertTrue(os.path.isfile(str(p)))
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)