def test_multi_obj_inter(self): key_vals = {'fake_key': 'fake_val'} inter_dict = {'fake_ref': key_vals} test_dict = { 'obj_id_0': inter_dict, 'obj_id_1': inter_dict, 'obj_id_2': inter_dict } node_list = [] for i in range(0, 3): temp_obj = ObjNode('obj_id_{}'.format(i)) temp_inter = InterNode('fake_path', **key_vals) _patch_ne(temp_obj) _patch_ne(temp_inter) temp_inter.addParent(temp_obj) temp_obj.addChild(temp_inter) node_list.append(temp_obj) self.helper_mock.return_value = {'fake_ref': 'fake_path'} cut_tree = obj_tree._dfs_cut(test_dict, InterNode('fake_ref')) _init_patch(cut_tree) self.assertObjEquals(node_list, cut_tree)
def test_obj_multi_inter(self): key_vals = {'fake_key': 'fake_val'} test_dict = { 'obj_id': { 'fake_ref_0': key_vals, 'fake_ref_1': key_vals, 'fake_ref_2': key_vals } } test_obj = ObjNode('obj_id') _patch_ne(test_obj) for i in range(0, 3): temp_inter = InterNode('fake_path_{}'.format(i), **key_vals) _patch_ne(temp_inter) temp_inter.addParent(test_obj) test_obj.addChild(temp_inter) self.helper_mock.return_value = { 'fake_ref_0': 'fake_path_0', 'fake_ref_1': 'fake_path_1', 'fake_ref_2': 'fake_path_2' } cut_tree = obj_tree._dfs_cut(test_dict, InterNode('fake_ref_0')) _init_patch(cut_tree) self.assertObjEquals([test_obj], cut_tree)
def test_obj_inter(self): key_vals = {'fake_key': 'fake_val'} test_dict = {'obj_id': {'fake_ref': key_vals}} test_obj = ObjNode('obj_id') test_inter = InterNode('fake_path', **key_vals) _patch_ne(test_obj) _patch_ne(test_inter) test_inter.addParent(test_obj) test_obj.addChild(test_inter) self.helper_mock.return_value = {'fake_ref': 'fake_path'} # test_inter is passed here to take the place of the root node cut_tree = obj_tree._dfs_cut(test_dict, test_inter) _init_patch(cut_tree) self.assertObjEquals([test_obj], cut_tree)
def test_inter_inter(self): key_vals = {'fake_key': 'fake_val'} test_dict = {'fake_ref_0': {'fake_ref_1': key_vals}} test_inter = InterNode('fake_path_0') _patch_ne(test_inter) test_inter_2 = InterNode('fake_path_1', **key_vals) _patch_ne(test_inter_2) test_inter_2.addParent(test_inter) test_inter.addChild(test_inter_2) self.helper_mock.return_value = { 'fake_ref_0': 'fake_path_0', 'fake_ref_1': 'fake_path_1' } cut_tree = obj_tree._dfs_cut(test_dict, InterNode('fake_ref_0')) _init_patch(cut_tree) self.assertObjEquals([test_inter], cut_tree)