def test_drop_disjunctive_index(self, mock_index): comparable = Compare() comparable.index_column_name = mock_index data1 = { 'id': ['1', '2', 'a', 'b', 'c'], "fname": ['p1', 'q1', 'r1', 's1', 'j1'] } comparable.data_frame = pd.DataFrame(data=data1, dtype="object") disjunctive = {'id': ['1', '2']} comparable.disjunctive_index = pd.DataFrame(data=disjunctive, dtype="object") index_validator.drop_disjunctive_index(comparable) expected = ['a', 'b', 'c'] actual = list(comparable.data_frame['id'].values) assert expected == actual
def check_for_disjunctive_index(comparable_a: Compare, comparable_b: Compare): index_name_a = idx.get_index_name(comparable_a) index_name_b = idx.get_index_name(comparable_b) comparable_a.disjunctive_index = comparable_a.data_frame[ ~comparable_a.data_frame[index_name_a].isin(comparable_b. data_frame[index_name_b])]