Skip to content

Commit 61ccb22

Browse files
test: add df column type check
1 parent 911268b commit 61ccb22

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

nisystemlink/clients/product/utilities/_dataframe_utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def convert_products_to_dataframe(products: List[Product]) -> DataFrame:
1818
- A new column would be created for unique properties across all products. The property
1919
columns would be named in the format `properties.property_name`.
2020
"""
21-
products_dict_representation = [product.dict(exclude_none=True) for product in products]
21+
products_dict_representation = [
22+
product.dict(exclude_none=True) for product in products
23+
]
2224
normalized_products_dataframe = pd.json_normalize(
2325
products_dict_representation, sep="."
2426
)

tests/product/test_product_dataframe_utilities.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ def test__convert_products_to_dataframe__with_complete_data(
8484
products_dataframe.columns.to_list()
8585
== expected_products_dataframe.columns.to_list()
8686
)
87+
assert products_dataframe["updated_at"].dtype == "datetime64[ns]"
88+
assert products_dataframe["file_ids"].dtype == "object"
89+
assert isinstance(products_dataframe["file_ids"].iloc[0], List)
90+
assert products_dataframe["keywords"].dtype == "object"
91+
assert isinstance(products_dataframe["keywords"].iloc[0], List)
8792
pd.testing.assert_frame_equal(
8893
products_dataframe, expected_products_dataframe, check_dtype=True
8994
)

0 commit comments

Comments
 (0)