Block 149: Capstone: Testing & Validation
Write tests for your project's critical components.
Concepts
- Unit tests for data cleaning functions
- Testing API endpoints
- Validating model predictions on known inputs
- Edge case testing
Code Examples
See exercise below.
Exercise
Write at least 5 pytest tests for your project. Test: data loading, a cleaning function, a feature engineering function, and at least one model prediction. Run pytest and fix any failures.
Homework
What would happen if your data source changes format? How would tests catch this? Write a test that would fail on a schema change.