-
Notifications
You must be signed in to change notification settings - Fork 315
fix: error if eval()-ing repr(SchemaField) #1046
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
Conversation
evaled_field = eval(field_repr) | ||
|
||
assert field == evaled_field | ||
|
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.
For completeness, do we need a round-trip test for the case where there is a policy tuple?
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.
Would not hurt, I'll add it.
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.
Guess what, that extra test actually revealed deeper issues in the repr()
of SchemaField
and PolicyTagList
.
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.
W00t!
The repr() should be evaluable.
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.
Thanks!
* fix: error if eval()-ing repr(SchemaField) * Make repr(PolicyTagList) evaluable * Fix SchemaField repr with policy tags The repr() should be evaluable. Co-authored-by: Tres Seaver <[email protected]>
Fixes #1041.
If policy tags are not set, the corresponding key should be
None
to denote a missing value. An empty tuple should only be used when the schema has explicitly emptyPolicyTagList
assigned.PR checklist: