Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #23, based on #24 for obvious reasons
Note that
test_core/test_grades.py
is currently failing, even before this PR -- maybe something to do with Moodle 5.0 compatibility?This PR reimplements
to_dict()
and changes some behavior that was not depended upon:Due to recursion, the function could previously accept any value and also accept a
name
parameter. The actual recursion is now in a nested function, so Iname
parameter.This means that you can't pass a
@attr.s
class directly to the function. You can see the commented regressed test case here:moodlepy/tests/test_utils/test_helper.py
Lines 44 to 46 in 6e580f1
If you have concerns about this, I can of course also handle this case.
I didn't know what the purpose of these lines were so I didn't preserve them:
moodlepy/moodle/utils/helper.py
Lines 31 to 33 in 760fb0c
because of this, I have marked this PR as a draft. It hasn't caused regressions, though.
You can take a look at cd3d959 to see what previously failing test cases now succeed. Additionally, in 2e552b8 I edited the test case to fail as described in #23.
Beyond that one calendar test case, I have not tested that the new behavior matches PHP's expectations of form encoded data, so I'd ask you to look over the test cases.