def test_depth_recursion(self): A = Group('A') B = Group('B') A.add_child_group(B) # hypothetical of adding B as child group to A A.parent_groups.append(B) B.child_groups.append(A) # can't update depths of groups, because of loop with self.assertRaises(AnsibleError): B._check_children_depth()