Test pysize_fs_tree
[pysize.git] / tests / tests / fs_tree.py
blob2d4902b0668c41af123ed4272247a91c03e56bc0
1 import unittest
2 from pysize.core import pysize_fs_tree
3 from pysize.core.pysize_global_fs_cache import drop_caches
5 class TestFsTree(unittest.TestCase):
6 def testTree(self):
7 tree = pysize_fs_tree.pysize_tree(['/tmp/pysize_example_dir'], 10, 0.02)
8 root = tree.root
9 child = tree.get_first_child(tree.get_first_child(root))
10 self.assertEqual(tree.get_previous_sibling(child), None)
11 child = tree.get_first_child(tree.get_first_child(child))
12 self.assertEqual(tree.get_previous_sibling(child), None)
13 parent = tree.get_parent(tree.get_parent(child))
14 parent = tree.get_parent(tree.get_parent(parent))
15 self.assertEqual(parent, root)
16 next = tree.get_next_sibling(child)
17 self.assertEqual(tree.get_previous_sibling(next), child)
18 count = 0
19 while next:
20 next = tree.get_next_sibling(next)
21 count += 1
22 self.assertEqual(count, 9)
24 TESTS = (TestFsTree,)