Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 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)))
Exemplo n.º 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)
Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 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)))
Exemplo n.º 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)