def test_initial(self): for path in ["/", "/home", os.environ["HOME"], "/usr/bin"]: dirlist = DirectoryTree(path) model, rows = dirlist.get_selection().get_selected_rows() selected = [model[row][0] for row in rows] dirlist.destroy() self.failUnlessEqual([path], selected)
def test_bad_initial(self): for path in ["/", os.environ["HOME"]]: newpath = os.path.join(path, "bin/file/does/not/exist") dirlist = DirectoryTree(newpath) model, rows = dirlist.get_selection().get_selected_rows() selected = [model[row][0] for row in rows] dirlist.destroy() self.failUnlessEqual([path], selected)
def test_bad_initial(self): invalid = os.path.join("bin", "file", "does", "not", "exist") for path in self.ROOTS: newpath = os.path.join(path, invalid) dirlist = DirectoryTree(newpath, folders=self.ROOTS) selected = dirlist.get_selected_paths() dirlist.destroy() # select the last valid parent directory self.assertEqual(len(selected), 1) self.assertTrue(selected[0].startswith(path))
def test_initial(self): paths = ["/", get_home_dir(), "/usr/bin"] if os.name == "nt": paths = [u"C:\\", get_home_dir()] for path in paths: dirlist = DirectoryTree(path, folders=self.ROOTS) model, rows = dirlist.get_selection().get_selected_rows() selected = [model[row][0] for row in rows] dirlist.destroy() self.failUnlessEqual([path], selected)
def test_initial(self): if os.name == "nt": paths = [u"C:\\", get_home_dir()] else: paths = ["/", get_home_dir(), sys.prefix] for path in paths: dirlist = DirectoryTree(path, folders=self.ROOTS) model, rows = dirlist.get_selection().get_selected_rows() selected = [model[row][0] for row in rows] dirlist.destroy() self.failUnlessEqual([os.path.normpath(path)], selected)
def test_bad_go_to(self): newpath = fsnative(u"/woooooo/bar/fun/broken") dirlist = DirectoryTree(fsnative(u"/"), folders=self.ROOTS) dirlist.go_to(newpath) dirlist.destroy()
def test_bad_go_to(self): newpath = "/woooooo/bar/fun/broken" dirlist = DirectoryTree("/") dirlist.go_to(newpath) dirlist.destroy()
def test_bad_go_to(self): newpath = "/woooooo/bar/fun/broken" dirlist = DirectoryTree("/", folders=self.ROOTS) dirlist.go_to(newpath) dirlist.destroy()