From d69fb2b0dad23836f12c67c52ba877a0065c73c1 Mon Sep 17 00:00:00 2001 From: Gunther Cox Date: Mon, 24 Nov 2025 19:27:30 -0500 Subject: [PATCH 1/2] Add support for Python 3.14 --- .github/workflows/python-package.yml | 2 +- mathparse/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 339807b..cab6b97 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v2 diff --git a/mathparse/__init__.py b/mathparse/__init__.py index dd526e7..1103506 100644 --- a/mathparse/__init__.py +++ b/mathparse/__init__.py @@ -2,4 +2,4 @@ mathparse is a library for solving mathematical equations contained in strings """ -__version__ = '0.2.6' +__version__ = '0.2.7' diff --git a/pyproject.toml b/pyproject.toml index 9e9e1cf..0f564e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ version = {attr = "mathparse.__version__"} [project] name = "mathparse" -requires-python = ">=3.9,<3.14" +requires-python = ">=3.9,<3.15" urls = { Documentation = "https://mathparse.chatterbot.us", Repository = "https://github.com/gunthercox/mathparse", Changelog = "https://github.com/gunthercox/mathparse/releases" } authors = [ {name = "Gunther Cox"}, From 2f25c2577f63b254fdc01f3bad28ada99c1bcc29 Mon Sep 17 00:00:00 2001 From: Gunther Cox Date: Mon, 24 Nov 2025 19:32:09 -0500 Subject: [PATCH 2/2] Handle more specific error message in newer Python versions --- tests/test_prefix_unary_operations.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_prefix_unary_operations.py b/tests/test_prefix_unary_operations.py index 70073d1..07376ed 100644 --- a/tests/test_prefix_unary_operations.py +++ b/tests/test_prefix_unary_operations.py @@ -155,7 +155,13 @@ def test_sqrt_with_negative_causes_math_error(self): # Verify it causes the expected math error with self.assertRaises(ValueError) as context: mathparse.parse('sqrt -16') - self.assertIn("math domain error", str(context.exception).lower()) + # Python 3.14+ uses more specific error messages + error_msg = str(context.exception).lower() + self.assertTrue( + "math domain error" in error_msg or + "expected a nonnegative input" in error_msg, + f"Unexpected error message: {error_msg}" + ) def test_log_with_negative_causes_math_error(self): """ @@ -168,7 +174,13 @@ def test_log_with_negative_causes_math_error(self): # Verify it causes the expected math error with self.assertRaises(ValueError) as context: mathparse.parse('log -10') - self.assertIn("math domain error", str(context.exception).lower()) + # Python 3.14+ uses more specific error messages + error_msg = str(context.exception).lower() + self.assertTrue( + "math domain error" in error_msg or + "expected a positive input" in error_msg, + f"Unexpected error message: {error_msg}" + ) def test_sqrt_with_positive_after_operator(self): """