Skip to content
cccskills
FreePublished on GitHub

test-generator

Generate pytest test cases for Python functions and classes

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md1.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Test Generator Skill

You are a test generation expert. When generating tests, follow these guidelines:

Test Structure

Use pytest with the following structure:

import pytest
from module import function_to_test

class TestFunctionName:
    """Tests for function_name."""

    def test_basic_case(self):
        """Test the basic/happy path."""
        result = function_to_test(valid_input)
        assert result == expected_output

    def test_edge_case(self):
        """Test edge cases."""
        ...

    def test_error_handling(self):
        """Test error conditions."""
        with pytest.raises(ExpectedError):
            function_to_test(invalid_input)

Test Categories

1. Happy Path Tests

  • Test normal, expected inputs
  • Verify correct output

2. Edge Cases

  • Empty inputs (empty string, empty list, None)
  • Boundary values (0, -1, max int)
  • Single element collections

3. Error Cases

  • Invalid types
  • Out of range values
  • Missing required parameters

4. Integration Tests (if applicable)

  • Test interactions between components
  • Test with real dependencies where possible

Best Practices

  1. One assertion per test when possible
  2. Descriptive test names that explain what's being tested
  3. Use fixtures for common setup
  4. Use parametrize for testing multiple inputs
  5. Mock external dependencies

Example: Parametrized Test

@pytest.mark.parametrize("input,expected", [
    (0, 0),
    (1, 1),
    (5, 120),
    (10, 3628800),
])
def test_factorial(input, expected):
    assert factorial(input) == expected

Example: Testing Async Functions

import pytest

@pytest.mark.asyncio
async def test_async_function():
    result = await async_function()
    assert result == expected

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Building, compiling, and resolving dependency issues across languages

The English summary is being prepared. Showing the original description.

vstorm-co/pydantic-deepagents1.1KUpdated Oct 19, 2026

Review Python code for quality, security, and best practices

The English summary is being prepared. Showing the original description.

vstorm-co/pydantic-deepagents1.1KUpdated Oct 19, 2026

Systematic code review for bugs, security, style, and performance

The English summary is being prepared. Showing the original description.

vstorm-co/pydantic-deepagents1.1KUpdated Oct 19, 2026

Comprehensive data analysis skill for CSV files using Python and pandas

The English summary is being prepared. Showing the original description.

vstorm-co/pydantic-deepagents1.1KUpdated Oct 19, 2026

Working with diverse data formats: binary, text, structured, and custom

The English summary is being prepared. Showing the original description.

vstorm-co/pydantic-deepagents1.1KUpdated Oct 19, 2026

Best practices for creating research diagrams with Excalidraw MCP tools

The English summary is being prepared. Showing the original description.

vstorm-co/pydantic-deepagents1.1KUpdated Oct 19, 2026

See all skills by vstorm-co

Report a problem with this skill