def test_FullPaths(self): root = '~/root' p = Path(root, is_expand=True) self.assertEqual([os.path.expanduser(os.path.join(root, 'A'))], p.FullPaths('A')) self.assertEqual([os.path.expanduser(os.path.join(root, 'A')), os.path.expanduser(os.path.join(root, 'B'))], p.FullPaths('A','B')) children = ['A', 'B'] self.assertEqual([os.path.expanduser(os.path.join(root, c)) for c in children], p.FullPaths(children)) self.assertEqual([os.path.expanduser(os.path.join(root, c)) for c in children], p.FullPaths(*children)) children = [pathlib.Path('A'), pathlib.Path('B')] self.assertEqual([os.path.expanduser(os.path.join(root, c)) for c in children], p.FullPaths(children)) self.assertEqual([os.path.expanduser(os.path.join(root, c)) for c in children], p.FullPaths(*children))
def test_FullPaths_TypeError(self): p = Path() children = ['A', pathlib.Path('B'), ['C'], ('D',), [['E',['F']]]] with self.assertRaises(TypeError) as e: p.FullPaths(children)
#p.Root = 'A' p.Root = '/A' print(p.Root) #p.Child = '/B' p.Child = 'B' print(p.Child) print(p.FullPath) print(p.Join('C')) print(p.Join('C', 'D', 'E')) print(p.Join(['C', 'D', 'E'])) print(p.Join(['C'], ['D', 'E'])) print(p.Join(['C'], ['D', ['E']])) print(p.Join(['C'], ['D', ['E', ['F']]])) print(p.Join(('C'), ('D', ('E', ('F'))))) print(p.Join(['C'], ('D', ('E', ('F'))))) print(p.FullPaths('C', 'E/F', 'GH')) print(p.FullPaths(['C', 'E/F', 'GH'])) p.Root = pathlib.Path('/A') print(p.Root) p.Child = pathlib.Path('B') print(p.Child) print(p.FullPath) print(p.Join()) print(p.Join('C')) print(p.Join(pathlib.Path('C'))) print(p.Join('C', pathlib.Path('D'), ('E', ), ['F'])) print(p.Join(['C', pathlib.Path('D'), ('E', ), ['F']])) print( p.Join([ 'C',