-
Notifications
You must be signed in to change notification settings - Fork 0
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
Allow deserialization of undefined object #482
Conversation
@@ -23,8 +24,9 @@ | |||
from urllib.parse import quote | |||
|
|||
import requests | |||
from dateutil.parser import parse | |||
from requests.structures import CaseInsensitiveDict | |||
with warnings.catch_warnings(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was causing issues when I was trying to trap specific warnings.
""" | ||
|
||
if data is None: | ||
return None | ||
|
||
if klass_name == "object": | ||
warnings.warn("Attempting to deserialize an object with no defined type. Returning " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to provide more information about the problematic model, but it's surprisingly hard to get to given the recursive calling.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #482 +/- ##
==========================================
+ Coverage 94.30% 94.35% +0.05%
==========================================
Files 7 7
Lines 773 780 +7
==========================================
+ Hits 729 736 +7
Misses 44 44 ☔ View full report in Codecov by Sentry. |
Codacy is complaining about something that black now enforces. I vote we stick with black. |
Closes #469
Handle the case where a model contains an undefined "object" and so cannot be deserialized. Add a warning for this case, and a test that checks the new behavior.