Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install pytest
run: pip install pytest
- name: Install PyVMCON
run: pip install .
- name: Install PyVMCON with testing dependencies (pytest)
run: pip install '.[test]'
- name: Run pytest
run: pytest tests/
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.15.4
rev: v0.15.13
hooks:
- id: ruff-check
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pip install .
Documentation for the VMCON algorithm and PyVMCON API/use can be found on our [**GitHub pages**](https://ukaea.github.io/PyVMCON/). The documentation includes references to the VMCON paper and other helpful resources.

## Testing
Tests can be run using `pytest tests/`. The tests check the paper examples are replicated.
Tests can be run by installing the optional test dependencies `pip install 'PyVMCON[test]'` and then running `pytest tests/`. The tests check the examples from the original VMCON paper are replicated.

## License
PyVMCON is provided under the MIT license, please see the LICENSE file for full details.
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Documentation = "https://ukaea.github.io/PyVMCON/"
Source = "https://github.com/ukaea/PyVMCON"

[project.optional-dependencies]
test = ["pytest"]
docs = [
"Sphinx>=6.1",
"sphinxcontrib-mermaid>=0.9",
Expand Down Expand Up @@ -56,3 +57,6 @@ ignore = [
[tool.ruff.lint.per-file-ignores]
"*.ipynb" = ["T201", "S311", "ANN", "D103"]
"tests/*" = ["INP001", "ANN", "D103", "S101", "SLF001", "PLR0915", "PLR2004"]

[tool.ruff.format]
preview = true
47 changes: 20 additions & 27 deletions tests/test_vmcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,22 @@ class BRevisionAsset:
B=np.identity(2),
ksi=np.array([-0.66666666666666663, -0.83333333333333348]),
eta=np.array([-1.3425925925925923, -1.7129629629629632]),
expected_return=np.array(
[
[1.3858727457706470, 0.50241291449459347],
[0.50241291449459347, 1.6536252239598812],
]
),
expected_return=np.array([
[1.3858727457706470, 0.50241291449459347],
[0.50241291449459347, 1.6536252239598812],
]),
),
BRevisionAsset(
B=np.array(
[
[2.1875467668036239, 1.4714414127452644],
[1.4714414127452644, 2.7501870672148332],
]
),
B=np.array([
[2.1875467668036239, 1.4714414127452644],
[1.4714414127452644, 2.7501870672148332],
]),
ksi=np.array([-1.2385140125071988e-6, -6.1925700625482853e-7]),
eta=np.array([-3.6205427119684330e-6, -3.5255433852299234e-6]),
expected_return=np.array(
[
[2.1875592084316073, 1.4714730232083293],
[1.4714730232083293, 2.7502368318126678],
]
),
expected_return=np.array([
[2.1875592084316073, 1.4714730232083293],
[1.4714730232083293, 2.7502368318126678],
]),
),
],
)
Expand Down Expand Up @@ -75,17 +69,16 @@ def test_revise_B(test_asset):
expected_return=np.array([-1.3425925925925923, -1.7129629629629632]),
),
BRevisionAsset(
B=np.array(
[
[2.1875467668036239, 1.4714414127452644],
[1.4714414127452644, 2.7501870672148332],
]
),
B=np.array([
[2.1875467668036239, 1.4714414127452644],
[1.4714414127452644, 2.7501870672148332],
]),
ksi=np.array([-1.2385140125071988e-6, -6.1925700625482853e-7]),
eta=np.array([-3.6205427119684330e-6, -3.5255433852299234e-6]),
expected_return=np.array(
[-3.6205427119684330e-006, -3.5255433852299234e-006]
),
expected_return=np.array([
-3.6205427119684330e-006,
-3.5255433852299234e-006,
]),
),
],
)
Expand Down
Loading