Skip to content

test(csv-import): add the dastardly CSV pathology corpus#159

Open
paddymul wants to merge 1 commit into
mainfrom
test/dastardly-csv-dataset
Open

test(csv-import): add the dastardly CSV pathology corpus#159
paddymul wants to merge 1 commit into
mainfrom
test/dastardly-csv-dataset

Conversation

@paddymul

@paddymul paddymul commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Adds the dastardly CSV dataset — the CSV sibling of buckaroo's dastardly-dataframe corpus. One builder per pathological CSV, run through tallyman_read_csv to pin its behavior. Test-only; no production code changes.

What's here

  • tests/dastardly_csv_library.py — 25 pathology builders, each returning raw CSV bytes (several cases live below the text layer: BOM, NUL, non-UTF-8). Every docstring names the hazard, how DuckDB/Polars/Pandas behave, and what tallyman wants. Cases and numbering track docs/research/csv-importers/edge-cases.md.
  • tests/test_dastardly_csv.py — three layers:
    • TestCorpusIsDeterministic — the corpus-level guard: every case reaches a deterministic outcome (a parsed schema, or a ValueError carrying the tallyman_read_csv: contract prefix), never an unhandled exception or silent crash.
    • TestDocumentedBehavior — characterization/regression guards pinning tallyman's current behavior pathology by pathology (embedded newlines, BOM stripping, decimal comma, mixed-type escalation, leading zeros, duplicate headers, ragged-long, whitespace-flips-type, mixed newlines, ambiguous dates, tz-pinned naive timestamps, ...).
    • TestKnownGapsxfail markers for the behavior the ADR / edge-cases.md want but tallyman doesn't yet implement — ready-made red tests for the holistic edge-case pass (tallyman_read_csv: ragged/short CSV rows are silently null-filled instead of raising #142 ragged-short silent null-fill chief among them, plus NUL-as-structural-error and int-overflow-resolves).

Verification

uv run pytest tests/test_dastardly_csv.py47 passed, 3 xfailed against latest main. ruff check clean.

🤖 Generated with Claude Code

The CSV sibling of buckaroo's dastardly-dataframe dataset: one builder per
pathological CSV (embedded newlines, BOM, non-UTF-8, decimal comma, mixed
types past the infer window, ragged rows, NUL bytes, ambiguous dates, int
overflow, tz-pinned naive timestamps, ...), each drawn from
docs/research/csv-importers/edge-cases.md with the per-importer contrast in
its docstring.

test_dastardly_csv.py runs the corpus through tallyman_read_csv in three layers:
- TestCorpusIsDeterministic — every case parses or raises a contract ValueError,
  never an unhandled exception or silent crash.
- TestDocumentedBehavior — characterization guards pinning tallyman's current
  behavior pathology by pathology.
- TestKnownGaps — xfail markers for the behavior the ADR/edge-cases.md want but
  tallyman does not yet implement (#142 ragged-short null-fill chief among them),
  ready-made red tests for the holistic edge-case pass.

47 passed, 3 xfailed against current main.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant