-
Notifications
You must be signed in to change notification settings - Fork 11
Fix broken 3-byte-unicode-related unit test in Python 2.x #264
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #264 +/- ##
=======================================
Coverage 91.08% 91.08%
=======================================
Files 91 91
Lines 15846 15848 +2
=======================================
+ Hits 14433 14435 +2
Misses 1413 1413
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Question inline
8604cd6
to
94d81f8
Compare
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.
Feedback inline
…into fix/tele_ascii_key_test pull master changes.
[x] address the failing test case (test_write_event_msg_size_limit_char_more_than_1_bytes) in py27 that it can't handle (€) 3 bytes ascii char: Non-ASCII (€) character in file line, but no encoding declared;
[x] modify the test using unicode char ("a\u20acbc" ) as input instead of €
[x] modify the last assertion checking the message length is less than and equal to the accept limit instead of mathematically calculating the expected message vs the actual message content. in py27, it is recognizing the above unicode as 9 bytes, but py3 recognize it as 4 bytes, therefore the calculation in the last assertion never passed.
[x] remove € in __set_up_patches_func() Test_StatusHandlerTruncation.py
[x] the reason for that assertion change was the unicode as 9 bytes in py2, but py3 recognize it as 4 bytes, so the calculation in the that assertion will never passed, it's very difficult to get the exact mathematical result for both. so we went with
using the upper and lower bound limit in encoding to assert the truncation is applied and it's within a reasonable byte range