AI-Assisted Programming for PhD Researchers
Helmut Schmidt University — September 2026
Every “it works” you accept on faith is a bug you have agreed not to find yet.
Match the check to what changed:
| Change type | Check |
|---|---|
| Data code | tests on a known input |
| A plot | look at the file |
| A refactor | tests still green |
| A script | run it on real data |
The check turns a confident claim into an honest loop.
A file named test_*, a function named test_*, an assert:
Run the whole suite with one command:
Build a tiny input, call the function, assert the result:
import pandas as pd
from pipeline.io import load_raw, clean
def test_na_humidity_becomes_nan(tmp_path):
p = tmp_path / "m.csv" # Arrange
p.write_text(
"reading_id,station,timestamp,temperature,"
"temp_unit,humidity_pct,wind_ms\n"
"R0001,Alpha,2025-03-01 06:00,12.0,C,n/a,3.0\n"
)
df = clean(load_raw(p)) # Act
assert pd.isna(df.loc[0, "humidity_pct"]) # AssertWrite the test first, implement second:
Never let the agent edit tests to make them pass — the tests are read-only. A “fixed” test is often a deleted requirement.
Debug in five deliberate steps:
Force the hypotheses out before any edit:
You judge the hypotheses — that is the skill-preserving move.
In Lab 3 you make the pipeline prove itself:
clean()’s current behaviorLecture V — Verification and Testing with Agents | Dr. Tobias Vlćek | Home