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

Accept 'F' suffix for floats in python text-format parser. #19614

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 4 additions & 30 deletions conformance/text_format_failure_list_python.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,14 @@
# This is the list of text format conformance tests that are known to fail right
# now.
# TODO: These should be fixed.
Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMinValue_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMinValue_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Required.*.TextFormatInput.FloatFieldNegativeZero.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Required.*.TextFormatInput.FloatFieldNegativeZero_f.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Required.*.TextFormatInput.FloatFieldNegativeZero_f.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Required.*.TextFormatInput.FloatFieldNegative_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegative_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoNegativeOctal # Should have failed to parse, but didn't.
Required.*.TextFormatInput.FloatFieldNoOctal # Should have failed to parse, but didn't.
Required.*.TextFormatInput.FloatFieldTooLarge_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooLarge_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooSmall_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooSmall_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithInt32Max_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithInt32Max_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatField_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatField_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.NegDoubleFieldLargeNegativeExponentParsesAsNegZero.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_double: -0
Required.*.TextFormatInput.NegDoubleFieldLargeNegativeExponentParsesAsNegZero.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_double: -0
Required.*.TextFormatInput.NegFloatFieldLargeNegativeExponentParsesAsNegZero.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0
Expand All @@ -51,4 +23,6 @@ Required.*.TextFormatInput.FloatFieldMaxValue.ProtobufOutput
Required.*.TextFormatInput.FloatFieldMaxValue.TextFormatOutput # Output was not equivalent to reference message
Required.*.TextFormatInput.FloatFieldMaxValue_f.ProtobufOutput # Output was not equivalent to reference message
Required.*.TextFormatInput.FloatFieldMaxValue_f.TextFormatOutput # Output was not equivalent to reference message
Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Output was not equivalent to reference message
Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Output was not equivalent to reference message

30 changes: 0 additions & 30 deletions conformance/text_format_failure_list_python_cpp.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMinValue_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMinValue_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegative_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegative_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoNegativeOctal # Should have failed to parse, but didn't.
Required.*.TextFormatInput.FloatFieldNoOctal # Should have failed to parse, but didn't.
Required.*.TextFormatInput.FloatFieldTooLarge_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooLarge_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooSmall_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooSmall_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithInt32Max_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithInt32Max_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatField_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatField_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t
Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t
Required.*.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput # Output was not equivalent to reference message: modified: optional_string: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\
Expand Down
30 changes: 0 additions & 30 deletions conformance/text_format_failure_list_python_upb.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
# This is the list of text format conformance tests that are known to fail right
# now.
# TODO: These should be fixed.
Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMinValue_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldMinValue_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegative_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNegative_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldNoNegativeOctal # Should have failed to parse, but didn't.
Required.*.TextFormatInput.FloatFieldNoOctal # Should have failed to parse, but didn't.
Required.*.TextFormatInput.FloatFieldTooLarge_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooLarge_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooSmall_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldTooSmall_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithInt32Max_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithInt32Max_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldZero_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatFieldZero_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatField_F.ProtobufOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.FloatField_F.TextFormatOutput # Failed to parse input or produce output.
Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t
Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t
Required.*.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput # Output was not equivalent to reference message: modified: optional_string: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\
Expand Down
9 changes: 9 additions & 0 deletions python/google/protobuf/internal/text_format_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,15 @@ class TokenizerTest(_parameterized.TestCase):
(text_format.Tokenizer.ConsumeFloat, 1.23456),
],
),
dict(
testcase_name='_float_capital_suffix',
text='ID13: 1.23456F ',
expected=[
(text_format.Tokenizer.ConsumeIdentifier, 'ID13'),
_CreateConsumeLiteralToken(':'),
(text_format.Tokenizer.ConsumeFloat, 1.23456),
],
),
dict(
testcase_name='_float_exponent_suffix',
text='ID14: 1.2e+2f ',
Expand Down
Loading
Loading