diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..2446847 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,61 @@ +"""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[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()