testing-patterns

A set of testing conventions and examples for the IterableData project, a Python library that reads and writes data files. It covers test layout, naming, commands, and common checks.

In plain words
What is it for?
Use it when writing tests, debugging failures, or adding coverage, including running all tests, targeting one test, testing compressed files, and measuring coverage.
Why use it?
Consistent test structure makes tests easier to find, run, and maintain. The examples also show how to verify reading, writing, compression, and coverage.

Skill for Claude CodeCodexCursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/datenoio/iterabledata/testing-patterns
Any agent
npx skills add datenoio/iterabledata --skill testing-patterns
Clone the repo
git clone --depth 1 https://github.com/datenoio/iterabledata

Made for: Claude Code, Codex, Cursor.

Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,327 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.01327
Opus 5 $0.00015 $0.00664
Sonnet 5 $0.00006 $0.00265
Haiku 4.5 $0.00003 $0.00133

Measured 2d ago against content hash 4b5d5bf4609d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testing-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/skills/testing-patterns/SKILL.md · 246 lines

How it starts

The opening of the file, as written. The whole thing — 246 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Patterns

Test Structure

File Naming

  • Test files: test_*.py in tests/ directory
  • One test file per format/feature: test_csv.py, test_parquet.py
  • Test classes: Test* (e.g., TestCSV, TestParquet)
  • Test functions: test_* (e.g., test_read, test_write)

Running Tests

# All tests
pytest --verbose

# Specific test file
pytest tests/test_csv.py -v

# Specific test function
pytest tests/test_csv.py::TestCSV::test_read -v

# Parallel execution
pytest -n auto

# With coverage
pytest --cov=iterable --cov-report=html

Test Patterns

Basic Read Test

def test_read(self):
    with open_iterable('testdata/test.csv') as source:
        rows = list(source)
        assert len(rows) > 0
        assert isinstance(rows[0], dict)

Basic Write Test

def test_write(self, tmp_path):
    output = tmp_path / 'output.csv'
    data = [{'col1': 'val1', 'col2': 'val2'}]
    
    with open_iterable(output, 'w') as dest:
        dest.write_bulk(data)
    
    # Verify written data
    with open_iterable(output) as source:
        rows = list(source)
        assert rows == data

Compression Tests

def test_gzip_compression(self):
    with open_iterable('testdata/test.csv.gz') as source:
        rows = list(source)
        assert len(rows) > 0

Bulk Operations Test

def test_read_bulk(self):
    with open_iterable('testdata/test.csv') as source:
        chunks = list(source.read_bulk(size=100))
        assert len(chunks) > 0
        assert all(isinstance(chunk, list) for chunk in chunks)

Edge Cases

def test_empty_file(self):
    with open_iterable('testdata/empty.csv') as source:
        rows = list(source)
        assert rows == []

def test_malformed_data(self):
    with pytest.raises(ValueError):
        with open_iterable('testdata/malformed.csv') as source:
            list(source)

Read the full file on GitHub · 246 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 246 lines · 30 tokens per session scan A 4b5d5bf4609d

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository datenoio/iterabledata (37 stars, last pushed 12d ago), licensed MIT. It adds 30 tokens to every session and 1,327 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

fastapi

FastAPI best practices and conventions. Use when working with FastAPI APIs, Pydantic models, dependencies, streaming responses including Server-Sent Events (SSE), and serving frontend apps. Keeps FastAPI code clean and up to date with the latest features and patterns.

fastapi/fastapi · 57 tokens

breaking-change-report

Run the japicmp binary-compatibility report for wiremock-core and produce a filtered summary covering only @PublishedAPI-annotated classes. Use this when asked to generate, refresh, or summarise the breaking-changes report.

wiremock/wiremock · 50 tokens

geoserver-rest-api

Use when automating GeoServer management — programmatic workspace, datastore, and layer creation, style upload, service configuration via REST API. GeoServer REST API: manage GeoServer without GUI using curl, Python, or any HTTP client.

znlgis/opengis-skills · 53 tokens

create-or-update-pr

Create a pull request for the current branch, or update the existing one if it already exists. Regenerates the title (Conventional Commits format) and the body (Objective + What was done) from the actual changes, in English. INVOKE when the user asks to "open a PR", "create a PR", "update the PR", "update PR…

lukascivil/json-difference · 107 tokens

adhx

ADHX - X/Twitter Post Reader workflow skill. Use this skill when the user needs Fetch any X/Twitter post as clean LLM-friendly JSON. Converts x.com, twitter.com, or adhx.com links into structured data with full article content, author info, and engagement metrics. No scraping or browser required and the operator…

diegosouzapw/awesome-omni-skills · 87 tokens

Data Analyzer

Statistical analysis and data transformation service for CSV and JSON datasets.

agenthatch/agenthatch · 16 tokens