Skip to content
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

fix: error if eval()-ing repr(SchemaField) #1046

Merged
merged 5 commits into from Nov 4, 2021
Merged

Conversation

@plamut
Copy link
Contributor

@plamut plamut commented Nov 4, 2021

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 empty PolicyTagList assigned.

PR checklist:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
@plamut plamut requested a review from tswast Nov 4, 2021
@plamut plamut requested review from as code owners Nov 4, 2021
@google-cla google-cla bot added the cla: yes label Nov 4, 2021
evaled_field = eval(field_repr)

assert field == evaled_field

Copy link
Contributor

@tseaver tseaver Nov 4, 2021

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?

Copy link
Contributor Author

@plamut plamut Nov 4, 2021

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.

Copy link
Contributor Author

@plamut plamut Nov 4, 2021

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.

Copy link
Contributor

@tseaver tseaver Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W00t!

tseaver
tseaver approved these changes Nov 4, 2021
@plamut plamut requested a review from tseaver Nov 4, 2021
tswast
tswast approved these changes Nov 4, 2021
Copy link
Contributor

@tswast tswast left a comment

Thanks!

@tswast tswast merged commit 13ac860 into googleapis:main Nov 4, 2021
15 checks passed
@plamut plamut deleted the iss-1041 branch Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants