CSV Parsing Tests
Ticket: Add unit tests for CSV parsing robustness
Type: Enhancement / Quality
Affected Component: code_source_simule/pipeline.py, tests/test_pipeline.py
1. Context
The read_and_clean_csv function is critical to ensuring that incoming data is correct. It is used by the ETL pipeline to normalize CSV files and trigger price enrichment.
2. Objective
Strengthen the unit test suite so the function remains robust against degraded inputs, without changing its existing behavior.
3. Additions made
- Added unit tests covering:
- a CSV missing the
Tickercolumn (should return an empty DataFrame) - invalid
Pricevalues (N/A, format1 234.56) that should be normalized to a float - missing
Marketstack_Currencycolumn (should be added and set toUSD) - automatic filtering of
Cashrows and rows with missing tickers
4. Result
The pytest suite now passes successfully, and the new scenarios strengthen coverage of the CSV cleaning function.