From 08130dab31243b615324dff2fbcf21728c0d7448 Mon Sep 17 00:00:00 2001 From: Hyun Lee Date: Tue, 6 Jan 2026 16:55:24 -0700 Subject: [PATCH 1/4] Create Unit Tests workflow for Python 3.11 Will automatically run unit tests when a pull request is made. --- .github/workflows/Unit_Tests.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/Unit_Tests.yml diff --git a/.github/workflows/Unit_Tests.yml b/.github/workflows/Unit_Tests.yml new file mode 100644 index 00000000..e0b7d6c0 --- /dev/null +++ b/.github/workflows/Unit_Tests.yml @@ -0,0 +1,33 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Unit_Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + pytest --ignore=tests/old_unit_tests From 1e0914d3441e6a403e22aab42eefeb68cb5fae6f Mon Sep 17 00:00:00 2001 From: Hyun Lee Date: Tue, 6 Jan 2026 17:00:37 -0700 Subject: [PATCH 2/4] Fix path for pytest to ignore old unit tests --- .github/workflows/Unit_Tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Unit_Tests.yml b/.github/workflows/Unit_Tests.yml index e0b7d6c0..3d57fb53 100644 --- a/.github/workflows/Unit_Tests.yml +++ b/.github/workflows/Unit_Tests.yml @@ -30,4 +30,4 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - pytest --ignore=tests/old_unit_tests + pytest tests --ignore=tests/_old_unit_tests From 804c4b198aa1b99e47ff290c412014ca6c53f892 Mon Sep 17 00:00:00 2001 From: Hyun Lee Date: Tue, 13 Jan 2026 12:09:38 -0700 Subject: [PATCH 3/4] Fix import path for MultiCheb and MultiPower --- yroots/ChebyshevApproximator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yroots/ChebyshevApproximator.py b/yroots/ChebyshevApproximator.py index c682d1e3..9fd1500d 100644 --- a/yroots/ChebyshevApproximator.py +++ b/yroots/ChebyshevApproximator.py @@ -1,6 +1,6 @@ import numpy as np from numba import njit -from polynomial import MultiCheb, MultiPower +from yroots.polynomial import MultiCheb, MultiPower import itertools from scipy.fftpack import dctn import warnings From 8b931589f55dd8ea43128b3a23ec945e81d9bfad Mon Sep 17 00:00:00 2001 From: Hyun Lee Date: Tue, 20 Jan 2026 21:50:35 -0700 Subject: [PATCH 4/4] Refactor file paths for root data in tests Updated file paths for loading root data in tests. --- tests/test_Combined_Solver.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/test_Combined_Solver.py b/tests/test_Combined_Solver.py index aade17a5..f685a34f 100644 --- a/tests/test_Combined_Solver.py +++ b/tests/test_Combined_Solver.py @@ -2,6 +2,7 @@ import yroots as yr import yroots.ChebyshevSubdivisionSolver as ChebyshevSubdivisionSolver import pytest +from pathlib import Path # These are tests from Combined @@ -222,6 +223,12 @@ def test_exact_option(): We find the roots using the exact method and non-exact method. Then we make sure we got the same roots between the two, and that those roots are correct. """ + + THIS_DIR = Path(__file__).resolve().parent # .../tests + ROOT_DIR = THIS_DIR.parent # repo root (if tests/ is at root) + actual_roots_path = ROOT_DIR / "Polished_results" / "polished_2.3.npy" + chebfun_roots_path = ROOT_DIR / "Chebfun_results" / "test_roots_2.3.csv" + f = lambda x,y: np.sin(4*(x + y/10 + np.pi/10)) g = lambda x,y: np.cos(2*(x-2*y+ np.pi/7)) a,b = np.array([-1,-1]),np.array([1,1]) @@ -230,8 +237,8 @@ def test_exact_option(): yroots_non_exact = yr.solve(funcs,a,b,exact=False) yroots_exact = yr.solve(funcs,a,b,exact=True) - actual_roots = np.load('../Polished_results/polished_2.3.npy') - chebfun_roots = np.loadtxt('../Chebfun_results/test_roots_2.3.csv', delimiter=',') + actual_roots = np.load(actual_roots_path) + chebfun_roots = np.loadtxt(chebfun_roots_path, delimiter=',') assert len(yroots_non_exact) == len(actual_roots) assert len(yroots_exact) == len(actual_roots) @@ -275,4 +282,4 @@ def testoutside_neg1_pos1(): yroots, boxes = yr.solve(funcs, a, b, returnBoundingBoxes=True) for root, box in zip(yroots,boxes): box = ChebyshevSubdivisionSolver.TrackedInterval(box) - assert box.__contains__(root) == True \ No newline at end of file + assert box.__contains__(root) == True