Skip to content

Commit

Permalink
cleaning and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Leobouloc committed Jan 24, 2024
1 parent 0e0f366 commit 00a2614
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
20 changes: 5 additions & 15 deletions tests/models/edx/converters/xapi/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def test_models_edx_converters_xapi_video_ui_load_video_to_video_initialized(
expected xAPI statement.
"""
event = mock_instance(UILoadVideo)
event.context.course_id = (
"course-v1:a+b+c" # TODO: see why generation does not work and remove this
)
event.context.course_id = "course-v1:a+b+c"

platform_url = mock_url()

Expand Down Expand Up @@ -93,9 +91,7 @@ def test_models_edx_converters_xapi_video_ui_play_video_to_video_played(uuid_nam
xAPI statement.
"""
event = mock_instance(UIPlayVideo)
event.context.course_id = (
"course-v1:a+b+c" # TODO: see why generation does not work and remove this
)
event.context.course_id = "course-v1:a+b+c"

platform_url = mock_url()

Expand Down Expand Up @@ -160,9 +156,7 @@ def test_models_edx_converters_xapi_video_ui_pause_video_to_video_paused(
statement.
"""
event = mock_instance(UIPauseVideo)
event.context.course_id = (
"course-v1:a+b+c" # TODO: see why generation does not work and remove this
)
event.context.course_id = "course-v1:a+b+c"

platform_url = mock_url()

Expand Down Expand Up @@ -228,9 +222,7 @@ def test_models_edx_converters_xapi_video_ui_stop_video_to_video_terminated(
xAPI statement.
"""
event = mock_instance(UIStopVideo)
event.context.course_id = (
"course-v1:a+b+c" # TODO: see why generation does not work and remove this
)
event.context.course_id = "course-v1:a+b+c"

platform_url = mock_url()

Expand Down Expand Up @@ -295,9 +287,7 @@ def test_models_edx_converters_xapi_video_ui_seek_video_to_video_seeked(uuid_nam
xAPI statement.
"""
event = mock_instance(UISeekVideo)
event.context.course_id = (
"course-v1:a+b+c" # TODO: see why generation does not work and remove this
)
event.context.course_id = "course-v1:a+b+c"

platform_url = mock_url()

Expand Down
2 changes: 1 addition & 1 deletion tests/models/edx/open_response_assessment/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_models_edx_ora_get_peer_submission_event_field_with_valid_values():
)


def test_models_edx_ora_get_submission_for_staff_grading_event_field_with_valid_values():
def test_models_edx_ora_get_submission_for_staff_grading_event_field_with_valid_values(): # noqa: E501
"""Test that a valid `ORAGetSubmissionForStaffGradingEventField` does not raise a
`ValidationError`.
"""
Expand Down
4 changes: 1 addition & 3 deletions tests/models/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def test_models_validator_validate_with_an_invalid_page_close_event_writes_an_er
)
with caplog.at_level(logging.ERROR):
assert not list(result)
errors = [
"Input event is not valid."
]
errors = ["Input event is not valid."]
assert errors == [message for _, _, message in caplog.record_tuples]


Expand Down
12 changes: 3 additions & 9 deletions tests/models/xapi/base/test_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def test_models_xapi_base_statement_with_invalid_null_values(path, value):
"context__extensions__https://w3id.org/xapi/video",
],
)
@pytest.mark.parametrize(
"value", [None, {}]
)
@pytest.mark.parametrize("value", [None, {}])
def test_models_xapi_base_statement_with_valid_null_values(path, value):
"""Test that the statement does accept valid null values in extensions fields.
Expand Down Expand Up @@ -363,9 +361,7 @@ def test_models_xapi_base_statement_with_invalid_group_objects(klass):

kwargs = {"exclude_none": True}
statement = statement.model_dump(**kwargs)
statement["actor"]["member"] = [
mock_xapi_instance(klass).model_dump(**kwargs)
]
statement["actor"]["member"] = [mock_xapi_instance(klass).model_dump(**kwargs)]

for class_ in [
"BaseXapiAgentWithMbox",
Expand Down Expand Up @@ -571,9 +567,7 @@ def test_models_xapi_base_statement_should_consider_valid_all_defined_xapi_model
# All specific xAPI models should inherit BaseXapiStatement
assert issubclass(model, BaseXapiStatement)
statement = mock_xapi_instance(model)
statement = statement.json(
exclude_none=True, by_alias=True
)
statement = statement.json(exclude_none=True, by_alias=True)
try:
BaseXapiStatement(**json.loads(statement))
except ValidationError as err:
Expand Down

0 comments on commit 00a2614

Please sign in to comment.