en un clic
testing
// Testing conventions using pytest. Use when writing tests, creating fixtures, or running test suites.
// Testing conventions using pytest. Use when writing tests, creating fixtures, or running test suites.
Simplify and clean up code after changes are complete. Reduces complexity, improves readability, and ensures consistency.
Commit changes, push to remote, and create a pull request. Use for completing features or fixes ready for review.
Find and fix technical debt including duplicated code, dead code, outdated patterns, and code smells. Run at the end of sessions to clean up.
Python code style and formatting standards using Ruff. Use when writing or reviewing Python code.
Git workflow and commit conventions. Use when committing code, creating branches, or making pull requests.
LLM and ML development best practices with LangChain and transformers. Use when building AI/ML applications.
| name | testing |
| description | Testing conventions using pytest. Use when writing tests, creating fixtures, or running test suites. |
tests/ directory mirroring src/ structuretest_<module>.py or <module>_test.pytest_<description>scope="function" unless shared state is neededconftest.py for shared fixturesExample:
import pytest
@pytest.fixture
def sample_user():
"""Create a sample user for testing."""
return User(name="Test User", email="test@example.com")
def test_user_creation(sample_user):
assert sample_user.name == "Test User"
assert sample_user.email == "test@example.com"
@pytest.mark.parametrize for testing multiple inputsExample:
@pytest.mark.parametrize("input_val,expected", [
(1, 2),
(2, 4),
(0, 0),
])
def test_double(input_val, expected):
assert double(input_val) == expected
assert statementspytest-mock or unittest.mockpytestpytest --covpytest -vpytest tests/test_specific.pypytest tests/test_specific.py::test_name