Пример #1
0
 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'))
Пример #2
0
 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'))
Пример #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_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'))
Пример #8
0
 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'))
Пример #9
0
 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)))
Пример #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_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'))
Пример #12
0
 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'))
Пример #13
0
 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)))
Пример #14
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)