Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Nov 4, 2024
1 parent 001b05e commit ff79412
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/import_mapping/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,34 @@ def test_leaf_mapping_with_position_on_row_is_still_considered_as_pivoted(self):
},
)

def test_column_header_position_while_leaf_is_hidden(self):
header = ["Widget"]
data_source = iter(
[
["gadget"],
]
)
mappings = [
[
{"map_type": "EntityClass", "position": "header", "value": 0},
{"map_type": "Entity", "position": 0},
{"map_type": "EntityMetadata", "position": "hidden"},
]
]
convert_function_specs = {0: "string"}
convert_functions = {column: value_to_convert_spec(spec) for column, spec in convert_function_specs.items()}
mapped_data, errors = get_mapped_data(data_source, mappings, header, column_convert_fns=convert_functions)
self.assertEqual(errors, [])
self.assertEqual(
mapped_data,
{
"entity_classes": [
("Widget",),
],
"entities": [("Widget", "gadget")],
},
)


if __name__ == "__main__":
unittest.main()

0 comments on commit ff79412

Please sign in to comment.