python-test-design
Skill4 starsChanged 2 months agoApache-2.0View on GitHub
Create Python regression, property, stateful, differential, and adversarial tests. Use for missing behavioral evidence and cross-language contracts; use python-pytest for runner mechanics.
In this repository81 other files it gives its agents.
- agent-cli-designSkill
- agent-tool-boundariesSkill
- behavior-first-implementationSkill
- bounded-prototypeSkill
- bounded-pr-sliceSkill
- building-fdd-validationSkill
- context-efficiencySkill
- cross-language-contractsSkill
- cross-platform-agent-instructionsSkill
- design-interviewSkill
- diagnosis-loopSkill
- domain-languageSkill
- edge-cloud-syncSkill
- handoff-continuitySkill
- immutable-pr-reviewSkill
- memory-context-hygieneSkill
- module-designSkill
- orchestrateSkill
- owner-decision-gateSkill
- parallel-portfolioSkill
- pr-gate-loopSkill
- pyo3-async-lifecycleSkill
- pyo3-buffer-performanceSkill
- pyo3-free-threadingSkill
- pyo3-ownership-errorsSkill
- pyo3-wheel-releaseSkill
- python-api-typingSkill
- python-async-concurrencySkill
- python-ci-releaseSkill
- python-data-boundariesSkill
- python-packaging-environmentsSkill
- python-performanceSkill
- python-pytestSkill
- python-reviewSkill
- python-threading-workersSkill
- python-workflowSkill
- react-components-stateSkill
- react-performanceSkill
- repository-groundingSkill
- rust-api-designSkill
- rust-async-concurrencySkill
- rust-build-diagnosticsSkill
- rust-ci-releaseSkill
- rust-memory-layoutSkill
- rust-nextestSkill
- rust-numerics-simdSkill
- rust-performanceSkill
- rust-protocol-codecsSkill
- rust-python-bindingsSkill
- rust-reviewSkill
- rust-storage-durabilitySkill
- rust-test-designSkill
- rust-unsafe-ffiSkill
- rust-workflowSkill
- rust-workspace-dependenciesSkill
- shadcn-react-componentsSkill
- shadcn-svelte-componentsSkill
- simplify-existing-codeSkill
- source-verificationSkill
- svelte-components-runesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Write the test that would reject the wrong implementation.
- Distinctive: line 31
Read domain cases for useful portfolio-shaped tests.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Behavioral Testing
Write the test that would reject the wrong implementation. Begin with an observable contract, an input domain, and the failure mode—not a coverage percentage. Keep a small regression near the affected API and use the project's existing testing tools.
Choose an honest oracle
Use hand-derived expectations, independent fixtures, a protocol specification, or a genuinely independent implementation as appropriate. A Python wrapper calling the same Rust routine as the expected-value generator is not an independent oracle. Round trips can preserve the same encoder/decoder bug; supplement them with known wire values and invalid input.
For numerics distinguish exact values, bitwise determinism, units, tolerances, and approximation quality. Never widen tolerances or regenerate goldens just because a refactor fails. Treat graph or protocol domain sentinels separately from None and zero.
Exercise boundaries and state
Cover empty/singleton/large input, integer range and bool coercion, Unicode and bytes, missing versus explicit null, timestamps and timezone transitions, malformed nested structures, duplicate identifiers, and non-finite values where relevant. Test invalid input before and after valid calls to expose polluted state.
For lifecycle APIs test partial setup failure, close twice, operations after close, cancel before/after admission, timeout racing with completion, and exceptions during cleanup. Coordinate concurrency with events/barriers and bounded joins; sleeps can be a watchdog but should not be the synchronization argument. Assert no extra writes or leaked permits, not only the exception class.
Property-based tests are useful when the domain has broad combinations or state transitions. Reuse Hypothesis if present; define meaningful strategies, retain a minimized failing example, and bound expensive cases. Do not suppress health checks or eliminate adversarial inputs merely to make CI fast. Long randomized campaigns belong in a staged lane, with a small regression in ordinary tests.
Keep evidence independent of test scaffolding
Patch the symbol where it is looked up and use constrained mocks. Mock clocks/transports at a stable seam, not the code under test. Include real local integration for framing, imports, and runtime transitions that a mock would erase. Native crash/deadlock cases belong in fresh subprocesses with an outer timeout.
Report the behavior each added test protects, the oracle and its limitations, and actual results. Use python-pytest for selection mechanics when installed; the test design stands on its own.
Read domain cases for useful portfolio-shaped tests.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

