Skip to content

Add parameters_panel property to CodeExercise #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024
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
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
Loading