Coverage Target: 70% code coverage Testing Framework: pytest 7.4.0 Python Version: 3.13 OS: macOS 14.6
Data Layer (src/data_loader.py)
Mock S3 connections and error handling
CSV parsing with malformed data
Date normalization across formats
Account ID standardization
Feature Engineering (src/feature_build.py)
90-day Interest window validation
270-day Intent window validation
Aggregation with missing/null values
Edge case handling (empty accounts)
Model Training (src/train.py)
Model reproducibility (same seed → same output)
Calibration procedures
Model serialization/deserialization
Scoring (src/score.py, src/intent_scorer.py, src/icp_scorer.py)
Tier assignments (Low/Medium/High at 33/66 thresholds)
Score normalization (0-100 scale)
Overall score weights (40/40/20)
SHAP explanation generation
Full pipeline: S3 → features → training → scoring → hot-list
Test with 100, 1K, 10K account datasets
Config parameter propagation
Output format validation (CSV, Parquet)
Performance benchmarking (training time, memory usage, SHAP performance)
Reliability (network failures, corrupted data, out-of-memory)
Historical validation against actual conversions
Class imbalance handling
Sales team validates top 20 accounts
SHAP explanations interpretability
A/B test against current method
ROI measurement
Test Files:
tests/
├── test_data_loader.py
├── test_feature_build.py
├── test_train.py
├── test_score.py
├── test_icp_scorer.py
└── test_intent_scorer.py
Priority Test Cases:
test_data_loader.py:
Account ID normalization (string/float handling)
Date parsing (multiple formats)
Missing column handling
test_feature_build.py:
90-day Interest window calculation
270-day Intent window calculation
Empty account handling
test_train.py:
Model reproducibility
Score range (0-100)
test_score.py:
Tier thresholds (33/66)
Overall score calculation (40/40/20)
test_intent_scorer.py:
Rule-based scoring logic
Reason generation
test_icp_scorer.py:
ICP tier assignments
Firmographic scoring rules
Run Tests:
make test # Runs: pytest tests/ -v --tb=short
Environment: Python 3.13, pytest 7.4.0, macOS 14.6
Full Pipeline Test:
make full-pipeline
Test Scenarios:
Small dataset (100 accounts)
Edge cases (no activity, missing data)
S3 vs local data source
Validation:
Pipeline completes without errors
Outputs generated in artifacts/scores/
Hot list contains top accounts
Environment: Same as unit tests + AWS S3 credentials
Scenarios:
Missing S3 data (fallback to local)
Duplicate account IDs
Invalid date formats
High % missing values
Expected: Graceful error messages, clear logging
# Unit tests
make test
# Integration test
make full-pipeline
# Calibration validation
make calibrate
# Pipeline status
make status
70%+ unit test coverage, all passing
Full pipeline runs without errors
Model calibration passes validation
Performance < 30 min end-to-end
Sales team validates top accounts
Required:
Python 3.13
pytest 7.4.0
pandas 2.0.0+
scikit-learn 1.3.0+
lightgbm 4.0.0+
shap 0.42.0+
boto3 1.28.0+ (for S3)
Install: make install