Fixed unit test failures for test_terminal_output_response_charset_detection and test_terminal_output_request_charset_detection#1855
Open
jautung wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1855 +/- ##
==========================================
- Coverage 97.28% 94.11% -3.18%
==========================================
Files 67 113 +46
Lines 4235 7694 +3459
==========================================
+ Hits 4120 7241 +3121
- Misses 115 453 +338 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These two unit tests were failing due to incorrect encoding detection of
卷首卷首卷首卷首卷卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首-> big5. The unit tests used an ambiguous Big5 test string thatcharset_normalizercould not reliably distinguish from Johab.Added (temporary, not committed) debugging logs to
encoding.py:detect_encoding:Noted that, with the current (original) text string of:
卷首卷首卷首卷首卷卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首卷首, we were getting:The best match was johab, and big5 was the second best match in the list. Some byte sequences are genuinely ambiguous between encodings like Big5, Johab, and Shift-JIS because they share overlapping byte ranges, so this makes sense.
Fix: updated the test string to be
你好世界。你好世界。你好世界。你好世界。你好世界。你好世界。你好世界。, which is unambigiously big5-encoded:All tests are passing now.