Test-driven development (TDD) defines expected behavior in automated tests before writing the code that satisfies them. In AI-assisted development, the engineer can write the tests while a model implements the function. The ordering matters: defining correctness first encourages active consideration of failure modes before generated code influences judgment. section 1.4
import pytest
# Assume is_valid_isbn13 is the function to be generated
def test_valid_isbn_with_hyphens():
assert is_valid_isbn13("978-0-306-40615-7") is True
def test_valid_isbn_without_hyphens():
assert is_valid_isbn13("9780306406157") is True
def test_invalid_checksum():
assert is_valid_isbn13("978-0-306-40615-0") is False
def test_invalid_length():
assert is_valid_isbn13("978-0-306-40615") is False
def test_contains_non_numeric_characters():
assert is_valid_isbn13("978-0-306-40615-X") is FalseThese pytest cases define expected behavior for an ISBN-13 validator before implementation, including valid formats, an invalid checksum, incorrect length, and nonnumeric characters. section 1.4
A passing suite verifies only the checks it contains. For a feature, extend the contract beyond function tests to cover API schemas, invariants, error semantics, and performance gates. Security also needs explicit requirements and a separate verification gate; happy-path tests alone can miss a vulnerable implementation. section 1.4 section 1.5
At feature scale, the familiar Red → Green → Refactor rhythm becomes Specify → Implement → Verify. A human-authored executable specification guides implementation and verification; engineers still need to judge whether it captures the intended behavior before merging. section 1.5 section 1.8






















