Skip to content

Commit 619fd7f

Browse files
authored
raises NotImplementedError for data/function backgrounds (#57)
* added error if attempt to use data or function models * raises NotImplementedError for data/function backgrounds * changed to field validator * added return to field validator
1 parent d4fb0bb commit 619fd7f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

RATapi/models.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ class Background(RATModel):
6262
value_4: str = ""
6363
value_5: str = ""
6464

65+
@field_validator("type")
66+
@classmethod
67+
def validate_unimplemented_backgrounds(cls, type: TypeOptions):
68+
"""Raise an error if currently unsupported Data or Function backgrounds are used."""
69+
# FIXME: once data/function backgrounds have been implemented,
70+
# please remember to remove the @pytest.mark.skip decorators used to skip the tests:
71+
# - tests/test_project.py::test_check_allowed_background_resolution_values_data
72+
# - tests/test_project.py::test_check_allowed_background_resolution_values_on_data_list
73+
if type == TypeOptions.Data:
74+
raise NotImplementedError("Data backgrounds are not yet supported.")
75+
if type == TypeOptions.Function:
76+
raise NotImplementedError("Function backgrounds are not yet supported.")
77+
return type
78+
6579

6680
class Contrast(RATModel):
6781
"""Groups together all of the components of the model."""

tests/test_project.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ def test_check_allowed_background_resolution_values_constant(test_value: str) ->
958958
)
959959

960960

961+
@pytest.mark.skip("Data backgrounds not currently supported.")
961962
@pytest.mark.parametrize(
962963
"test_value",
963964
[
@@ -999,6 +1000,7 @@ def test_check_allowed_background_resolution_values_not_on_constant_list(test_va
9991000
)
10001001

10011002

1003+
@pytest.mark.skip("Data backgrounds not currently supported.")
10021004
@pytest.mark.parametrize(
10031005
"test_value",
10041006
[

0 commit comments

Comments
 (0)