Unit Tests for Data Transformations
Test a cleaning function with small known cases.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
Write tests for a data transformation function. The function and its purpose: [PASTE_FUNCTION_AND_PURPOSE]. Input schema and example rows: [INPUT_SCHEMA]. Expected output rules: [EXPECTED_RULES]. Test framework: [TEST_FRAMEWORK]. Deliver: 1. A list of behaviors to test, grouped as normal cases, boundary cases (empty frame, single row, all nulls, duplicates, maximum values), and error cases (missing columns, wrong dtype). 2. For each behavior a tiny input DataFrame built in the test, an exact expected DataFrame, and the assertion with pd.testing.assert_frame_equal (explain check_dtype, check_like). 3. One property-based idea (the output has no more rows than the input; totals are preserved) and how to test it. 4. A fixture for shared sample data and a parametrized test for ten tricky values. 5. A regression test from a real bug I describe: [BUG_DESCRIPTION]. 6. How to keep tests fast and free of real personal data. Write the full test file. If the function's rules are ambiguous, list the questions instead of assuming.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.