From 8c39c5b6bb38211ab022cbb18be88315b90e2e5b Mon Sep 17 00:00:00 2001 From: Yuichi Motoyama Date: Tue, 4 Jun 2024 11:01:57 +0900 Subject: [PATCH] test for python 3.11 --- .github/workflows/python_package.yml | 6 +++--- tests/unit/test_variable.py | 18 +++--------------- tox.ini | 3 ++- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index af4caba4..ee105b93 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -4,15 +4,15 @@ on: [push] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false max-parallel: 3 matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3,11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/tests/unit/test_variable.py b/tests/unit/test_variable.py index 6b77c999..663f75fe 100644 --- a/tests/unit/test_variable.py +++ b/tests/unit/test_variable.py @@ -36,15 +36,6 @@ def test_get_subset(variable, X, t, Z, index): assert np.array_equal(var2.Z, Z[index, :]) -def test_delete(variable, mocker): - delete_X = mocker.patch("physbo.variable.delete_X") - delete_t = mocker.patch("physbo.variable.delete_t") - delete_Z = mocker.patch("physbo.variable.delete_Z") - variable.delete(1) - delete_X.assert_called_once_with(1) - delete_t.assert_called_once_with(1) - delete_Z.assert_called_once_with(1) - @pytest.mark.parametrize("index", [2, [0, 1]]) def test_delete_X(variable, X, index): @@ -68,13 +59,10 @@ def test_delete_Z(variable, Z, index): def test_add(variable, X, t, Z, mocker): - add_X = mocker.patch("physbo.variable.add_X") - add_t = mocker.patch("physbo.variable.add_t") - add_Z = mocker.patch("physbo.variable.add_Z") variable.add(X, t, Z) - add_X.assert_called_once_with(X) - add_t.assert_called_once_with(t) - add_Z.assert_called_once_with(Z) + assert np.array_equal(variable.X, np.vstack((X,X))) + assert np.array_equal(variable.t, np.hstack((t,t))) + assert np.array_equal(variable.Z, np.vstack((Z,Z))) def test_add_X(variable, X): diff --git a/tox.ini b/tox.ini index c2fb14c9..e022c75d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] requires = tox>=4 -envlist = py37, py38, py39, py310, docs +envlist = py37, py38, py39, py310, py311, docs isolated_build = true [gh-actions] @@ -9,6 +9,7 @@ python = '3.8': py38 '3.9': py39 '3.10': py310 + '3.11': py311 [testenv] deps =