- Home
- Skills
- Dmitriiweb
- Extract Emails
- Pytest Testing Assistant
pytest-testing-assistant_skill
- Python
106
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill dmitriiweb/extract-emails --skill pytest-testing-assistant- SKILL.md1.5 KB
Overview
This skill generates focused pytest tests as standalone functions for a Python parser that extracts emails and LinkedIn account links from URLs. Tests follow a one-behavior-per-function approach, avoid test classes, and emphasize clear arrange/act/assert structure. The output is ready to drop into a test file and run with pytest.
How this skill works
Given a target function or behavior (for example: parse_emails_from_html, extract_linkedin_profiles, or parse_from_url), the skill emits one dedicated test function per behavior. Each test uses explicit inputs, invokes the parser, and asserts the primary expected outcome with minimal supporting checks. Parametrization is used for small input matrices and fixtures are suggested sparingly to keep each test readable and isolated.
When to use it
- When adding or validating behavior for email extraction from HTML or fetched pages.
- When verifying LinkedIn profile link extraction and normalization from raw URLs or anchor tags.
- When refactoring parser code and needing tight, behavior-focused regression tests.
- When onboarding contributors who need clear, single-purpose examples of expected behavior.
- When building a small, maintainable test suite that runs fast and is easy to review.
Best practices
- Write one test function per behavior, named test_<function>_<behavior> for clarity.
- Prefer one primary assertion; include minimal secondary checks only when they add clarity.
- Keep arrange/act/assert sections explicit and short; avoid hidden setup in many fixtures.
- Use pytest.mark.parametrize for concise tables of input/output cases instead of loops.
- Test normalization and edge cases: empty input, malformed HTML, duplicate addresses, and relative links.
Example use cases
- test_parse_emails_simple: feed a snippet of HTML and assert the exact set of emails returned.
- test_extract_linkedin_absolute_and_relative: ensure both absolute and relative LinkedIn hrefs are normalized to full profile URLs.
- test_parse_from_url_handles_network_error: simulate a failed HTTP fetch and assert the function returns an empty list or raises a documented exception.
- test_no_false_positive_emails: provide text that resembles emails but is invalid and assert the parser excludes them.
FAQ
Avoid test classes here; use standalone functions to keep tests isolated and readable. Use fixtures only when they simplify repeated setup without hiding intent.
When should I parametrize tests?
Parametrize when you have a small matrix of input/output pairs that differ only by values. For complex scenarios prefer separate tests to keep failure messages focused.