Files
api-testgen-cli/tests/conftest.py
CI Bot b536daa983 fix: add tests and project configuration for CI/CD
- Add tests directory with comprehensive test suite
- Add development configuration files (requirements-dev.txt, setup.cfg)
- Add pre-commit hooks and gitignore for project hygiene
- Ensure CI workflow has all necessary files to run 121 tests
2026-02-06 03:44:37 +00:00

62 lines
1.8 KiB
Python

"""Pytest configuration and fixtures for regex humanizer tests."""
import pytest
from regex_humanizer.parser import RegexParser, parse_regex
from regex_humanizer.translator import RegexTranslator, translate_regex
from regex_humanizer.test_generator import TestCaseGenerator, generate_test_cases
@pytest.fixture
def parser():
"""Provide a RegexParser instance."""
return RegexParser
@pytest.fixture
def translator():
"""Provide a RegexTranslator instance."""
return RegexTranslator("pcre")
@pytest.fixture
def test_generator():
"""Provide a TestCaseGenerator instance."""
return TestCaseGenerator("pcre")
@pytest.fixture
def sample_patterns():
"""Provide sample regex patterns for testing."""
return {
"simple_literal": "hello",
"character_class": "[a-z]",
"quantifier_plus": "a+",
"quantifier_star": "b*",
"quantifier_question": "c?",
"digit": "\\d{3}",
"word": "\\w+",
"email": "[a-z]+@[a-z]+\\.[a-z]+",
"phone": "\\d{3}-\\d{4}",
"ip_address": "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}",
"url": "https?://[^\\s]+",
"date": "\\d{4}-\\d{2}-\\d{2}",
"group": "(hello)\\s+(world)",
"named_group": "(?P<name>[a-z]+)",
"lookahead": "\\d+(?=px)",
"negative_lookahead": "\\d+(?!px)",
"lookbehind": "(?<=\\$)\\d+",
"non_capturing": "(?:hello)\\s+(?:world)",
"alternation": "cat|dog",
"anchor_start": "^start",
"anchor_end": "end$",
"word_boundary": "\\bword\\b",
"complex": "^(?:http|https)://[\\w.-]+\\.(?:com|org|net)$",
}
@pytest.fixture
def flavor_manager():
"""Provide the flavor manager."""
from regex_humanizer.flavors import get_flavor_manager
return get_flavor_manager()