def testTreePathMethods(self): db = new_test_database() mockindex = tests.MockObject() mockindex._db = db mockindex.update_iter = tests.MockObject() mockindex.update_iter.pages = tests.MockObject() model = PagesTreeModelMixin(mockindex) # Test all pages for name, treepath in TREEPATHS: myiter = model.get_mytreeiter(treepath) self.assertEqual(myiter.row['name'], name) self.assertEqual(myiter.treepath, treepath) my_treepath = model.find(Path(name)) self.assertEqual(my_treepath, treepath) # Test non-existing p = model.get_mytreeiter((1, 2, 3, 4, 5)) self.assertIsNone(p) self.assertRaises(IndexNotFoundError, model.find, Path('non-existing-page'))
def __init__(self, index): PagesTreeModelMixin.__init__(self, index) PageTreeStoreBase.__init__(self)
def __init__(self, index, root=None, reverse=False): PagesTreeModelMixin.__init__(self, index, root, reverse) PageTreeStoreBase.__init__(self)