Skip to content

Commit 22512ba

Browse files
feanilclaude
andcommitted
fix: set graceperiod to a real timedelta in upstream sync test
The string '2d' couldn't be parsed by Timedelta.from_json and was silently coerced to None, triggering ModifyingEnforceTypeWarning (the assertion happened to pass because enforce_type is disabled for this codepath and the raw value was preserved). Using a real timedelta avoids the warning and makes the field type explicit. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 877eae4 commit 22512ba

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cms/lib/xblock/test/test_upstream_sync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def test_sync_updates_to_downstream_only_fields(self):
293293
downstream.attempts_before_showanswer_button = 2
294294
downstream.due = datetime.datetime(2025, 2, 2, tzinfo=datetime.timezone.utc) # noqa: UP017
295295
downstream.force_save_button = True
296-
downstream.graceperiod = '2d'
296+
downstream.graceperiod = datetime.timedelta(days=2)
297297
downstream.grading_method = 'last_score'
298298
downstream.max_attempts = 100
299299
downstream.show_correctness = 'always'
@@ -321,7 +321,7 @@ def test_sync_updates_to_downstream_only_fields(self):
321321
assert downstream.attempts_before_showanswer_button == 2
322322
assert downstream.due == datetime.datetime(2025, 2, 2, tzinfo=datetime.timezone.utc) # noqa: UP017
323323
assert downstream.force_save_button
324-
assert downstream.graceperiod == '2d'
324+
assert downstream.graceperiod == datetime.timedelta(days=2)
325325
assert downstream.grading_method == 'last_score'
326326
assert downstream.max_attempts == 100
327327
assert downstream.show_correctness == 'always'

0 commit comments

Comments
 (0)