-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ruff configuration so that it runs on all files in the reposit…
…ory.
- Loading branch information
Showing
12 changed files
with
78 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
from hypothesis import given | ||
import hypothesis.strategies as st | ||
import pytest | ||
from hypothesis import given | ||
|
||
from zodipy import model_registry | ||
|
||
ALL_MODELS = model_registry.models | ||
|
||
|
||
@given(st.sampled_from(ALL_MODELS)) | ||
def test_get_model(model) -> None: | ||
def test_get_model(model: str) -> None: | ||
"""Tests that the model can be retrieved.""" | ||
model_registry.get_model(model) | ||
|
||
|
||
def test_get_model_raises_error() -> None: | ||
"""Tests that an error is raised when the model is not found.""" | ||
with pytest.raises(ValueError): | ||
model_registry.get_model("metins_model") | ||
|
||
|
||
def test_register_model() -> None: | ||
"""Tests that a model can be registered.""" | ||
DIRBE_model = model_registry.get_model("DIRBE") | ||
DIRBE_model.T_0 += 250 | ||
model_registry.register_model("metins_model", DIRBE_model) | ||
|
||
|
||
def test_register_model_raises_error() -> None: | ||
"""Tests that an error is raised when the model is already registered.""" | ||
with pytest.raises(ValueError): | ||
model_registry.register_model("DIRBE", model_registry.get_model("DIRBE")) |
Oops, something went wrong.