Test your Python data code:
Unit tests: Test transformations with small sample data.
def test_clean_nulls():
input_df = pd.DataFrame({'a': [1, None, 3]})
result = clean_nulls(input_df)
assert result['a'].isna().sum() == 0
Integration tests: Test against real (dev) databases.
Contract tests: Verify output matches expected schema.
Fixtures: Create reusable test data.
@pytest.fixture
def sample_orders():
return pd.DataFrame({
'order_id': [1, 2, 3],
'amount': [100, 200, 150]
})
Run tests in CI. Block merges on test failure.