Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| import pytest | |
| hypothesis = pytest.importorskip("hypothesis") | |
| st = hypothesis.strategies | |
| given = hypothesis.given | |
| settings = hypothesis.settings | |
| HealthCheck = hypothesis.HealthCheck | |
| from core.extractor import ExpressionExtractor # noqa: E402 | |
| from core.parser import ExpressionParser # noqa: E402 | |
| SAFE_ALPHABET = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+-*/^(){}[]\\ ,.=→∞") | |
| def test_parser_never_raises_on_fuzzy_math_like_input(text): | |
| parser = ExpressionParser() | |
| out = parser.parse(text) | |
| assert isinstance(out, dict) | |
| assert "success" in out | |
| if out["success"]: | |
| assert "sympy_expr" in out | |
| else: | |
| assert "error" in out | |
| def test_extractor_never_raises_on_fuzzy_math_like_input(text): | |
| extractor = ExpressionExtractor() | |
| inner, params = extractor.extract(text) | |
| assert isinstance(inner, str) | |
| assert isinstance(params, dict) | |