[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AFTE8BS7362SBBCN9C4C8K":3,"skill-same:01M7AFTE8BS7362SBBCN9C4C8K":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M7AFTE8BS7362SBBCN9C4C8K","python-testing",null,"Python testing best practices using pytest including fixtures, parametrization, mocking, coverage analysis, async testing, and test organization. Use when writing or improving Python tests.","Cyrilthetecchieee\u002Fcyril-code-","Cyrilthetecchieee","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219787998?v=4","01M7AF0MMMKRAA0H61XMJPV92H","Julian Cyril D ","01M7AF0MQ10AVG6QJQ1C2BC0F5",2,"MIT","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002F.kiro\u002Fskills\u002Fpython-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: python-testing\ndescription: >\n  Python testing best practices using pytest including fixtures, parametrization,\n  mocking, coverage analysis, async testing, and test organization. Use when\n  writing or improving Python tests.\nmetadata:\n  origin: ECC\n  globs: [\"**\u002F*.py\", \"**\u002F*.pyi\"]\n---\n\n# Python Testing\n\n> This skill provides comprehensive Python testing patterns using pytest as the primary testing framework.\n\n## Testing Framework\n\nUse **pytest** as the testing framework for its powerful features and clean syntax.\n\n### Basic Test Structure\n\n```python\ndef test_user_creation():\n    \"\"\"Test that a user can be created with valid data\"\"\"\n    user = User(name=\"Alice\", email=\"alice@example.com\")\n\n    assert user.name == \"Alice\"\n    assert user.email == \"alice@example.com\"\n    assert user.is_active is True\n```\n\n### Test Discovery\n\npytest automatically discovers tests following these conventions:\n- Files: `test_*.py` or `*_test.py`\n- Functions: `test_*`\n- Classes: `Test*` (without `__init__`)\n- Methods: `test_*`\n\n## Fixtures\n\nFixtures provide reusable test setup and teardown:\n\n```python\nimport pytest\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\n@pytest.fixture\ndef db_session():\n    \"\"\"Provide a database session for tests\"\"\"\n    engine = create_engine(\"sqlite:\u002F\u002F\u002F:memory:\")\n    Session = sessionmaker(bind=engine)\n    session = Session()\n\n    # Setup\n    Base.metadata.create_all(engine)\n\n    yield session\n\n    # Teardown\n    session.close()\n\ndef test_user_repository(db_session):\n    \"\"\"Test using the db_session fixture\"\"\"\n    repo = UserRepository(db_session)\n    user = repo.create(name=\"Alice\", email=\"alice@example.com\")\n\n    assert user.id is not None\n```\n\n### Fixture Scopes\n\n```python\n@pytest.fixture(scope=\"function\")  # Default: per test\ndef user():\n    return User(name=\"Alice\")\n\n@pytest.fixture(scope=\"class\")  # Per test class\ndef database():\n    db = Database()\n    db.connect()\n    yield db\n    db.disconnect()\n\n@pytest.fixture(scope=\"module\")  # Per module\ndef app():\n    return create_app()\n\n@pytest.fixture(scope=\"session\")  # Once per test session\ndef config():\n    return load_config()\n```\n\n### Fixture Dependencies\n\n```python\n@pytest.fixture\ndef database():\n    db = Database()\n    db.connect()\n    yield db\n    db.disconnect()\n\n@pytest.fixture\ndef user_repository(database):\n    \"\"\"Fixture that depends on database fixture\"\"\"\n    return UserRepository(database)\n\ndef test_create_user(user_repository):\n    user = user_repository.create(name=\"Alice\")\n    assert user.id is not None\n```\n\n## Parametrization\n\nTest multiple inputs with `@pytest.mark.parametrize`:\n\n```python\nimport pytest\n\n@pytest.mark.parametrize(\"email,expected\", [\n    (\"user@example.com\", True),\n    (\"invalid-email\", False),\n    (\"\", False),\n    (\"user@\", False),\n    (\"@example.com\", False),\n])\ndef test_email_validation(email, expected):\n    result = validate_email(email)\n    assert result == expected\n```\n\n### Multiple Parameters\n\n```python\n@pytest.mark.parametrize(\"name,age,valid\", [\n    (\"Alice\", 25, True),\n    (\"Bob\", 17, False),\n    (\"\", 25, False),\n    (\"Charlie\", -1, False),\n])\ndef test_user_validation(name, age, valid):\n    result = validate_user(name, age)\n    assert result == valid\n```\n\n### Parametrize with IDs\n\n```python\n@pytest.mark.parametrize(\"input,expected\", [\n    (\"hello\", \"HELLO\"),\n    (\"world\", \"WORLD\"),\n], ids=[\"lowercase\", \"another_lowercase\"])\ndef test_uppercase(input, expected):\n    assert input.upper() == expected\n```\n\n## Test Markers\n\nUse markers for test categorization and selective execution:\n\n```python\nimport pytest\n\n@pytest.mark.unit\ndef test_calculate_total():\n    \"\"\"Fast unit test\"\"\"\n    assert calculate_total([1, 2, 3]) == 6\n\n@pytest.mark.integration\ndef test_database_connection():\n    \"\"\"Slower integration test\"\"\"\n    db = Database()\n    assert db.connect() is True\n\n@pytest.mark.slow\ndef test_large_dataset():\n    \"\"\"Very slow test\"\"\"\n    process_million_records()\n\n@pytest.mark.skip(reason=\"Not implemented yet\")\ndef test_future_feature():\n    pass\n\n@pytest.mark.skipif(sys.version_info \u003C (3, 10), reason=\"Requires Python 3.10+\")\ndef test_new_syntax():\n    pass\n```\n\n**Run specific markers:**\n```bash\npytest -m unit              # Run only unit tests\npytest -m \"not slow\"        # Skip slow tests\npytest -m \"unit or integration\"  # Run unit OR integration\n```\n\n## Mocking\n\n### Using unittest.mock\n\n```python\nfrom unittest.mock import Mock, patch, MagicMock\n\ndef test_user_service_with_mock():\n    \"\"\"Test with mock repository\"\"\"\n    mock_repo = Mock()\n    mock_repo.find_by_id.return_value = User(id=\"1\", name=\"Alice\")\n\n    service = UserService(mock_repo)\n    user = service.get_user(\"1\")\n\n    assert user.name == \"Alice\"\n    mock_repo.find_by_id.assert_called_once_with(\"1\")\n\n@patch('myapp.services.EmailService')\ndef test_send_notification(mock_email_service):\n    \"\"\"Test with patched dependency\"\"\"\n    service = NotificationService()\n    service.send(\"user@example.com\", \"Hello\")\n\n    mock_email_service.send.assert_called_once()\n```\n\n### pytest-mock Plugin\n\n```python\ndef test_with_mocker(mocker):\n    \"\"\"Using pytest-mock plugin\"\"\"\n    mock_repo = mocker.Mock()\n    mock_repo.find_by_id.return_value = User(id=\"1\", name=\"Alice\")\n\n    service = UserService(mock_repo)\n    user = service.get_user(\"1\")\n\n    assert user.name == \"Alice\"\n```\n\n## Coverage Analysis\n\n### Basic Coverage\n\n```bash\npytest --cov=src --cov-report=term-missing\n```\n\n### HTML Coverage Report\n\n```bash\npytest --cov=src --cov-report=html\nopen htmlcov\u002Findex.html\n```\n\n### Coverage Configuration\n\n```ini\n# pytest.ini or pyproject.toml\n[tool.pytest.ini_options]\naddopts = \"\"\"\n    --cov=src\n    --cov-report=term-missing\n    --cov-report=html\n    --cov-fail-under=80\n\"\"\"\n```\n\n### Branch Coverage\n\n```bash\npytest --cov=src --cov-branch\n```\n\n## Async Testing\n\n### Testing Async Functions\n\n```python\nimport pytest\n\n@pytest.mark.asyncio\nasync def test_async_fetch_user():\n    \"\"\"Test async function\"\"\"\n    user = await fetch_user(\"1\")\n    assert user.name == \"Alice\"\n\n@pytest.fixture\nasync def async_client():\n    \"\"\"Async fixture\"\"\"\n    client = AsyncClient()\n    await client.connect()\n    yield client\n    await client.disconnect()\n\n@pytest.mark.asyncio\nasync def test_with_async_fixture(async_client):\n    result = await async_client.get(\"\u002Fusers\u002F1\")\n    assert result.status == 200\n```\n\n## Test Organization\n\n### Directory Structure\n\n```\ntests\u002F\n├── unit\u002F\n│   ├── test_models.py\n│   ├── test_services.py\n│   └── test_utils.py\n├── integration\u002F\n│   ├── test_database.py\n│   └── test_api.py\n├── conftest.py          # Shared fixtures\n└── pytest.ini           # Configuration\n```\n\n### conftest.py\n\n```python\n# tests\u002Fconftest.py\nimport pytest\n\n@pytest.fixture(scope=\"session\")\ndef app():\n    \"\"\"Application fixture available to all tests\"\"\"\n    return create_app()\n\n@pytest.fixture\ndef client(app):\n    \"\"\"Test client fixture\"\"\"\n    return app.test_client()\n\ndef pytest_configure(config):\n    \"\"\"Register custom markers\"\"\"\n    config.addinivalue_line(\"markers\", \"unit: Unit tests\")\n    config.addinivalue_line(\"markers\", \"integration: Integration tests\")\n    config.addinivalue_line(\"markers\", \"slow: Slow tests\")\n```\n\n## Assertions\n\n### Basic Assertions\n\n```python\ndef test_assertions():\n    assert value == expected\n    assert value != other\n    assert value > 0\n    assert value in collection\n    assert isinstance(value, str)\n```\n\n### pytest Assertions with Better Error Messages\n\n```python\ndef test_with_context():\n    \"\"\"pytest provides detailed assertion introspection\"\"\"\n    result = calculate_total([1, 2, 3])\n    expected = 6\n\n    # pytest shows: assert 5 == 6\n    assert result == expected\n```\n\n### Custom Assertion Messages\n\n```python\ndef test_with_message():\n    result = process_data(input_data)\n    assert result.is_valid, f\"Expected valid result, got errors: {result.errors}\"\n```\n\n### Approximate Comparisons\n\n```python\nimport pytest\n\ndef test_float_comparison():\n    result = 0.1 + 0.2\n    assert result == pytest.approx(0.3)\n\n    # With tolerance\n    assert result == pytest.approx(0.3, abs=1e-9)\n```\n\n## Exception Testing\n\n```python\nimport pytest\n\ndef test_raises_exception():\n    \"\"\"Test that function raises expected exception\"\"\"\n    with pytest.raises(ValueError):\n        validate_age(-1)\n\ndef test_exception_message():\n    \"\"\"Test exception message\"\"\"\n    with pytest.raises(ValueError, match=\"Age must be positive\"):\n        validate_age(-1)\n\ndef test_exception_details():\n    \"\"\"Capture and inspect exception\"\"\"\n    with pytest.raises(ValidationError) as exc_info:\n        validate_user(name=\"\", age=-1)\n\n    assert \"name\" in exc_info.value.errors\n    assert \"age\" in exc_info.value.errors\n```\n\n## Test Helpers\n\n```python\n# tests\u002Fhelpers.py\ndef assert_user_equal(actual, expected):\n    \"\"\"Custom assertion helper\"\"\"\n    assert actual.id == expected.id\n    assert actual.name == expected.name\n    assert actual.email == expected.email\n\ndef create_test_user(**kwargs):\n    \"\"\"Test data factory\"\"\"\n    defaults = {\n        \"name\": \"Test User\",\n        \"email\": \"test@example.com\",\n        \"age\": 25,\n    }\n    defaults.update(kwargs)\n    return User(**defaults)\n```\n\n## Property-Based Testing\n\nUsing `hypothesis` for property-based testing:\n\n```python\nfrom hypothesis import given, strategies as st\n\n@given(st.integers(), st.integers())\ndef test_addition_commutative(a, b):\n    \"\"\"Test that addition is commutative\"\"\"\n    assert a + b == b + a\n\n@given(st.lists(st.integers()))\ndef test_sort_idempotent(lst):\n    \"\"\"Test that sorting twice gives same result\"\"\"\n    sorted_once = sorted(lst)\n    sorted_twice = sorted(sorted_once)\n    assert sorted_once == sorted_twice\n```\n\n## Best Practices\n\n1. **One assertion per test** (when possible)\n2. **Use descriptive test names** - describe what's being tested\n3. **Arrange-Act-Assert pattern** - clear test structure\n4. **Use fixtures for setup** - avoid duplication\n5. **Mock external dependencies** - keep tests fast and isolated\n6. **Test edge cases** - empty inputs, None, boundaries\n7. **Use parametrize** - test multiple scenarios efficiently\n8. **Keep tests independent** - no shared state between tests\n\n## Running Tests\n\n```bash\n# Run all tests\npytest\n\n# Run specific file\npytest tests\u002Ftest_user.py\n\n# Run specific test\npytest tests\u002Ftest_user.py::test_create_user\n\n# Run with verbose output\npytest -v\n\n# Run with output capture disabled\npytest -s\n\n# Run in parallel (requires pytest-xdist)\npytest -n auto\n\n# Run only failed tests from last run\npytest --lf\n\n# Run failed tests first\npytest --ff\n```\n\n## When to Use This Skill\n\n- Writing new Python tests\n- Improving test coverage\n- Setting up pytest infrastructure\n- Debugging flaky tests\n- Implementing integration tests\n- Testing async Python code\n","# Python Testing\n\n> This skill provides comprehensive Python testing patterns using pytest as the primary testing framework.\n\n## Testing Framework\n\nUse **pytest** as the testing framework for its powerful features and clean syntax.\n\n### Basic Test Structure\n\n```python\ndef test_user_creation():\n    \"\"\"Test that a user can be created with valid data\"\"\"\n    user = User(name=\"Alice\", email=\"alice@example.com\")\n\n    assert user.name == \"Alice\"\n    assert user.email == \"alice@example.com\"\n    assert user.is_active is True\n```\n\n### Test Discovery\n\npytest automatically discovers tests following these conventions:\n- Files: `test_*.py` or `*_test.py`\n- Functions: `test_*`\n- Classes: `Test*` (without `__init__`)\n- Methods: `test_*`\n\n## Fixtures\n\nFixtures provide reusable test setup and teardown:\n\n```python\nimport pytest\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\n@pytest.fixture\ndef db_session():\n    \"\"\"Provide a database session for tests\"\"\"\n    engine = create_engine(\"sqlite:\u002F\u002F\u002F:memory:\")\n    Session = sessionmaker(bind=engine)\n    session = Session()\n\n    # Setup\n    Base.metadata.create_all(engine)\n\n    yield session\n\n    # Teardown\n    session.close()\n\ndef test_user_repository(db_session):\n    \"\"\"Test using the db_session fixture\"\"\"\n    repo = UserRepository(db_session)\n    user = repo.create(name=\"Alice\", email=\"alice@example.com\")\n\n    assert user.id is not None\n```\n\n### Fixture Scopes\n\n```python\n@pytest.fixture(scope=\"function\")  # Default: per test\ndef user():\n    return User(name=\"Alice\")\n\n@pytest.fixture(scope=\"class\")  # Per test class\ndef database():\n    db = Database()\n    db.connect()\n    yield db\n    db.disconnect()\n\n@pytest.fixture(scope=\"module\")  # Per module\ndef app():\n    return create_app()\n\n@pytest.fixture(scope=\"session\")  # Once per test session\ndef config():\n    return load_config()\n```\n\n### Fixture Dependencies\n\n```python\n@pytest.fixture\ndef database():\n    db = Database()\n    db.connect()\n    yield db\n    db.disconnect()\n\n@pytest.fixture\ndef user_repository(database):\n    \"\"\"Fixture that depends on database fixture\"\"\"\n    return UserRepository(database)\n\ndef test_create_user(user_repository):\n    user = user_repository.create(name=\"Alice\")\n    assert user.id is not None\n```\n\n## Parametrization\n\nTest multiple inputs with `@pytest.mark.parametrize`:\n\n```python\nimport pytest\n\n@pytest.mark.parametrize(\"email,expected\", [\n    (\"user@example.com\", True),\n    (\"invalid-email\", False),\n    (\"\", False),\n    (\"user@\", False),\n    (\"@example.com\", False),\n])\ndef test_email_validation(email, expected):\n    result = validate_email(email)\n    assert result == expected\n```\n\n### Multiple Parameters\n\n```python\n@pytest.mark.parametrize(\"name,age,valid\", [\n    (\"Alice\", 25, True),\n    (\"Bob\", 17, False),\n    (\"\", 25, False),\n    (\"Charlie\", -1, False),\n])\ndef test_user_validation(name, age, valid):\n    result = validate_user(name, age)\n    assert result == valid\n```\n\n### Parametrize with IDs\n\n```python\n@pytest.mark.parametrize(\"input,expected\", [\n    (\"hello\", \"HELLO\"),\n    (\"world\", \"WORLD\"),\n], ids=[\"lowercase\", \"another_lowercase\"])\ndef test_uppercase(input, expected):\n    assert input.upper() == expected\n```\n\n## Test Markers\n\nUse markers for test categorization and selective execution:\n\n```python\nimport pytest\n\n@pytest.mark.unit\ndef test_calculate_total():\n    \"\"\"Fast unit test\"\"\"\n    assert calculate_total([1, 2, 3]) == 6\n\n@pytest.mark.integration\ndef test_database_connection():\n    \"\"\"Slower integration test\"\"\"\n    db = Database()\n    assert db.connect() is True\n\n@pytest.mark.slow\ndef test_large_dataset():\n    \"\"\"Very slow test\"\"\"\n    process_million_records()\n\n@pytest.mark.skip(reason=\"Not implemented yet\")\ndef test_future_feature():\n    pass\n\n@pytest.mark.skipif(sys.version_info \u003C (3, 10), reason=\"Requires Python 3.10+\")\ndef test_new_syntax():\n    pass\n```\n\n**Run specific markers:**\n```bash\npytest -m unit              # Run only unit tests\npytest -m \"not slow\"        # Skip slow tests\npytest -m \"unit or integration\"  # Run unit OR integration\n```\n\n## Mocking\n\n### Using unittest.mock\n\n```python\nfrom unittest.mock import Mock, patch, MagicMock\n\ndef test_user_service_with_mock():\n    \"\"\"Test with mock repository\"\"\"\n    mock_repo = Mock()\n    mock_repo.find_by_id.return_value = User(id=\"1\", name=\"Alice\")\n\n    service = UserService(mock_repo)\n    user = service.get_user(\"1\")\n\n    assert user.name == \"Alice\"\n    mock_repo.find_by_id.assert_called_once_with(\"1\")\n\n@patch('myapp.services.EmailService')\ndef test_send_notification(mock_email_service):\n    \"\"\"Test with patched dependency\"\"\"\n    service = NotificationService()\n    service.send(\"user@example.com\", \"Hello\")\n\n    mock_email_service.send.assert_called_once()\n```\n\n### pytest-mock Plugin\n\n```python\ndef test_with_mocker(mocker):\n    \"\"\"Using pytest-mock plugin\"\"\"\n    mock_repo = mocker.Mock()\n    mock_repo.find_by_id.return_value = User(id=\"1\", name=\"Alice\")\n\n    service = UserService(mock_repo)\n    user = service.get_user(\"1\")\n\n    assert user.name == \"Alice\"\n```\n\n## Coverage Analysis\n\n### Basic Coverage\n\n```bash\npytest --cov=src --cov-report=term-missing\n```\n\n### HTML Coverage Report\n\n```bash\npytest --cov=src --cov-report=html\nopen htmlcov\u002Findex.html\n```\n\n### Coverage Configuration\n\n```ini\n# pytest.ini or pyproject.toml\n[tool.pytest.ini_options]\naddopts = \"\"\"\n    --cov=src\n    --cov-report=term-missing\n    --cov-report=html\n    --cov-fail-under=80\n\"\"\"\n```\n\n### Branch Coverage\n\n```bash\npytest --cov=src --cov-branch\n```\n\n## Async Testing\n\n### Testing Async Functions\n\n```python\nimport pytest\n\n@pytest.mark.asyncio\nasync def test_async_fetch_user():\n    \"\"\"Test async function\"\"\"\n    user = await fetch_user(\"1\")\n    assert user.name == \"Alice\"\n\n@pytest.fixture\nasync def async_client():\n    \"\"\"Async fixture\"\"\"\n    client = AsyncClient()\n    await client.connect()\n    yield client\n    await client.disconnect()\n\n@pytest.mark.asyncio\nasync def test_with_async_fixture(async_client):\n    result = await async_client.get(\"\u002Fusers\u002F1\")\n    assert result.status == 200\n```\n\n## Test Organization\n\n### Directory Structure\n\n```\ntests\u002F\n├── unit\u002F\n│   ├── test_models.py\n│   ├── test_services.py\n│   └── test_utils.py\n├── integration\u002F\n│   ├── test_database.py\n│   └── test_api.py\n├── conftest.py          # Shared fixtures\n└── pytest.ini           # Configuration\n```\n\n### conftest.py\n\n```python\n# tests\u002Fconftest.py\nimport pytest\n\n@pytest.fixture(scope=\"session\")\ndef app():\n    \"\"\"Application fixture available to all tests\"\"\"\n    return create_app()\n\n@pytest.fixture\ndef client(app):\n    \"\"\"Test client fixture\"\"\"\n    return app.test_client()\n\ndef pytest_configure(config):\n    \"\"\"Register custom markers\"\"\"\n    config.addinivalue_line(\"markers\", \"unit: Unit tests\")\n    config.addinivalue_line(\"markers\", \"integration: Integration tests\")\n    config.addinivalue_line(\"markers\", \"slow: Slow tests\")\n```\n\n## Assertions\n\n### Basic Assertions\n\n```python\ndef test_assertions():\n    assert value == expected\n    assert value != other\n    assert value > 0\n    assert value in collection\n    assert isinstance(value, str)\n```\n\n### pytest Assertions with Better Error Messages\n\n```python\ndef test_with_context():\n    \"\"\"pytest provides detailed assertion introspection\"\"\"\n    result = calculate_total([1, 2, 3])\n    expected = 6\n\n    # pytest shows: assert 5 == 6\n    assert result == expected\n```\n\n### Custom Assertion Messages\n\n```python\ndef test_with_message():\n    result = process_data(input_data)\n    assert result.is_valid, f\"Expected valid result, got errors: {result.errors}\"\n```\n\n### Approximate Comparisons\n\n```python\nimport pytest\n\ndef test_float_comparison():\n    result = 0.1 + 0.2\n    assert result == pytest.approx(0.3)\n\n    # With tolerance\n    assert result == pytest.approx(0.3, abs=1e-9)\n```\n\n## Exception Testing\n\n```python\nimport pytest\n\ndef test_raises_exception():\n    \"\"\"Test that function raises expected exception\"\"\"\n    with pytest.raises(ValueError):\n        validate_age(-1)\n\ndef test_exception_message():\n    \"\"\"Test exception message\"\"\"\n    with pytest.raises(ValueError, match=\"Age must be positive\"):\n        validate_age(-1)\n\ndef test_exception_details():\n    \"\"\"Capture and inspect exception\"\"\"\n    with pytest.raises(ValidationError) as exc_info:\n        validate_user(name=\"\", age=-1)\n\n    assert \"name\" in exc_info.value.errors\n    assert \"age\" in exc_info.value.errors\n```\n\n## Test Helpers\n\n```python\n# tests\u002Fhelpers.py\ndef assert_user_equal(actual, expected):\n    \"\"\"Custom assertion helper\"\"\"\n    assert actual.id == expected.id\n    assert actual.name == expected.name\n    assert actual.email == expected.email\n\ndef create_test_user(**kwargs):\n    \"\"\"Test data factory\"\"\"\n    defaults = {\n        \"name\": \"Test User\",\n        \"email\": \"test@example.com\",\n        \"age\": 25,\n    }\n    defaults.update(kwargs)\n    return User(**defaults)\n```\n\n## Property-Based Testing\n\nUsing `hypothesis` for property-based testing:\n\n```python\nfrom hypothesis import given, strategies as st\n\n@given(st.integers(), st.integers())\ndef test_addition_commutative(a, b):\n    \"\"\"Test that addition is commutative\"\"\"\n    assert a + b == b + a\n\n@given(st.lists(st.integers()))\ndef test_sort_idempotent(lst):\n    \"\"\"Test that sorting twice gives same result\"\"\"\n    sorted_once = sorted(lst)\n    sorted_twice = sorted(sorted_once)\n    assert sorted_once == sorted_twice\n```\n\n## Best Practices\n\n1. **One assertion per test** (when possible)\n2. **Use descriptive test names** - describe what's being tested\n3. **Arrange-Act-Assert pattern** - clear test structure\n4. **Use fixtures for setup** - avoid duplication\n5. **Mock external dependencies** - keep tests fast and isolated\n6. **Test edge cases** - empty inputs, None, boundaries\n7. **Use parametrize** - test multiple scenarios efficiently\n8. **Keep tests independent** - no shared state between tests\n\n## Running Tests\n\n```bash\n# Run all tests\npytest\n\n# Run specific file\npytest tests\u002Ftest_user.py\n\n# Run specific test\npytest tests\u002Ftest_user.py::test_create_user\n\n# Run with verbose output\npytest -v\n\n# Run with output capture disabled\npytest -s\n\n# Run in parallel (requires pytest-xdist)\npytest -n auto\n\n# Run only failed tests from last run\npytest --lf\n\n# Run failed tests first\npytest --ff\n```\n\n## When to Use This Skill\n\n- Writing new Python tests\n- Improving test coverage\n- Setting up pytest infrastructure\n- Debugging flaky tests\n- Implementing integration tests\n- Testing async Python code\n",{"name":5,"metadata":24,"description":29},{"globs":25,"origin":28},[26,27],"**\u002F*.py","**\u002F*.pyi","ECC","Python testing best practices using pytest including fixtures, parametrization, mocking, coverage analysis, async testing, and test organization. Use when writing or improving Python tests.\n","main","57e7aa6b6e03bce1a7d7862ba9c2ec312f7f19b5","src\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002F.kiro\u002Fskills\u002Fpython-testing",0,"https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee","https:\u002F\u002Fwithcyril.me\u002F","Hi, I’m Julian Cyril D, a Computer Science and Business Systems student at PSNACET.\r\nI’m passionate about full-stack development, UI\u002FUX design, and building sma","2026-11-04 23:28:50",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add Cyrilthetecchieee\u002Fcyril-code- --skill python-testing",{"tool":45,"command":46},"bunx","bunx skills add Cyrilthetecchieee\u002Fcyril-code- --skill python-testing",{"tool":48,"command":49},"pnpm","pnpm dlx skills add Cyrilthetecchieee\u002Fcyril-code- --skill python-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002F.kiro\u002Fskills\u002Fpython-testing\u002FSKILL.md",true,[],[54,63,70,78,85,92],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AQV6CYX8RMC78420V9WZ62","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AQV2895N3S1MEX6K76G6G2","youtube-downloader","Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fvideo-downloader\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":74,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7AQTRNX62DNKVZ5GXEHRBKB","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7AQTNNVHAAN9H6DA8T6ZVE0","template-skill","Replace with description of the skill and when Claude should use it.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftemplate-skill\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7AQTJ3MQ6AKX152MEX2MYCC","tailored-resume-generator","Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftailored-resume-generator\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7AQTD7D5MYET2YWG7HG9WM3","slack-gif-creator","Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like \"make me a GIF for Slack of X doing Y\".","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FSKILL.md",[],[]]