Add conformance testing to string.format implementation #307
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 #257
This adds conformance testing to our implementation of
string.format. cel-python does not currently provide astring.formatfunction so we implement our own and add it to the protovalidate-python CEL runtime.While formatting is not (yet) a part of the cel-spec, they do provide conformance test data for validating behavior. So, to ensure we are conformant, we use this test data and run it against our implementation.
See the test data here. Note that this file contains various sections for testing. However, we are only concerned with the
formatandformat_errorssections. In addition, since we are only testing for formatting, we do not handle everyoneofcase or variation in theSimpleTestdefinition -- only expected results or evaluation errors. If others are added down the road in future versions of the spec, we can adjust these tests.