Exemple #1
0
    def test_map_columns_fuzzy(self):

        input_tbl = Table([['fn', 'ln', 'Mi_'], ['J', 'B', 'H']])

        column_map = {
            'first_name': ['fn', 'first'],
            'last_name': ['last', 'ln'],
            'middle_name': ['mi']
        }

        fuzzy_tbl = Table([['first_name', 'last_name', 'middle_name'],
                           ['J', 'B', 'H']])
        input_tbl.map_columns(column_map, exact_match=False)
        assert_matching_tables(input_tbl, fuzzy_tbl)
Exemple #2
0
    def test_map_columns(self):

        input_tbl = Table([['fn', 'ln'], ['J', 'B']])

        expected_tbl = Table([['first_name', 'last_name'], ['J', 'B']])

        column_map = {
            'first_name': ['fn', 'first'],
            'last_name': ['last', 'ln']
        }

        input_tbl.map_columns(column_map)

        assert_matching_tables(input_tbl, expected_tbl)
Exemple #3
0
    def test_map_columns_exact(self):

        input_tbl = Table([['fn', 'ln', 'MID'], ['J', 'B', 'H']])

        column_map = {
            'first_name': ['fn', 'first'],
            'last_name': ['last', 'ln'],
            'middle_name': ['mi']
        }

        exact_tbl = Table([['first_name', 'last_name', 'MID'], ['J', 'B',
                                                                'H']])
        input_tbl.map_columns(column_map)
        assert_matching_tables(input_tbl, exact_tbl)