Esempio n. 1
0
 def test_tree(self):
     self.assertEqual(
         _imply_category_ancestors({'grandparent': {'parent', 'aunt'},
                                    'parent': {'child1', 'child2'}}),
         {'parent': {'grandparent'},
          'aunt': {'grandparent'},
          'child1': {'grandparent', 'parent'},
          'child2': {'grandparent', 'parent'}})
Esempio n. 2
0
 def test_tree(self):
     self.assertEqual(
         _imply_category_ancestors({"grandparent": {"parent", "aunt"}, "parent": {"child1", "child2"}}),
         {
             "parent": {"grandparent"},
             "aunt": {"grandparent"},
             "child1": {"grandparent", "parent"},
             "child2": {"grandparent", "parent"},
         },
     )
Esempio n. 3
0
 def test_loop_of_size_3(self):
     self.assertEqual(_imply_category_ancestors({1: {2}, 2: {3}, 3: {1}}), {1: {2, 3}, 2: {1, 3}, 3: {1, 2}})
Esempio n. 4
0
 def test_loop_of_size_1(self):
     self.assertEqual(_imply_category_ancestors({1: {1}}), {})
Esempio n. 5
0
 def test_parent(self):
     self.assertEqual(_imply_category_ancestors({"parent": {"child"}}), {"child": {"parent"}})
Esempio n. 6
0
 def test_empty(self):
     self.assertEqual(_imply_category_ancestors({}), {})
Esempio n. 7
0
 def test_parent(self):
     self.assertEqual(
         _imply_category_ancestors({'parent': {'child'}}),
         {'child': {'parent'}})