Files
regex-humanizer-cli/tests/conftest.py
7000pctAUTO 550bc7d1cf
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled
CI / release (push) Has been cancelled
Initial upload: regex-humanizer-cli with CI/CD workflow
2026-02-06 01:09:46 +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()