Skip to content

Commit

Permalink
Add parameters_panel property to CodeExercise (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski authored Dec 19, 2024
1 parent 33a4b31 commit 8999150
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/scwidgets/exercise/_widget_code_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,14 @@ def answer(self, answer: dict):
if self._load_button is not None:
self._load_button.observe_widgets()

@property
def parameters_panel(self) -> Union[ParametersPanel, None]:
"""
:return: The parametergs panel widget.
"""

return self._parameters_panel

@property
def panel_parameters(self) -> Dict[str, Check.FunInParamT]:
"""
Expand Down
11 changes: 11 additions & 0 deletions tests/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ def update_print(code_ex: CodeExercise):


class TestCodeExercise:
@pytest.mark.parametrize(
"code_ex",
[
get_code_exercise(
[single_param_check(use_fingerprint=False, failing=False, buggy=False)],
)
],
)
def test_parameters_panel(self, code_ex):
assert code_ex.parameters_panel.parameters == code_ex.parameters

@pytest.mark.parametrize(
"code_ex",
[
Expand Down

0 comments on commit 8999150

Please sign in to comment.