runtime
394 / 500
question 394 Software Architecture · easy

Integration tests for the ratings report

write_report(in_path, out_path) reads a ratings CSV, averages each product's ratings and writes product_id,average lines. Write integration tests (test_… functions with assert) that run it on files in a temporary folder. They must pass for the real function and fail for three versions with wiring bugs.

Targetwrite_report(in_path, out_path): input product_id,rating with a header; output one product_id,average line per product, sorted by ID, averages rounded to 2 decimals; returns the number of products
Defects to catchthe header read as data; averages not rounded; products in input order instead of sorted

Loading your progress…

Integration tests for the ratings report — Python practice · Runtime