File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 55import sys
66
77def test_unicode_warning ():
8- """Test that triggers Unicode in warnings system"""
8+ """Test that triggers Unicode in warnings system - matches actual test behavior """
99 unicode_string = "\U00010002 abc--abc\u79d8 \u5bc6 \u4ee3 \u7801 -\u79d8 \u5bc6 \u4ee3 \u7801 "
1010
11+ # Don't print Unicode - just process it like the real test does
1112 print (f"Python version: { sys .version } " )
1213 print (f"Platform: { sys .platform } " )
13- print (f"Architecture: { sys .maxsize > 2 ** 32 } " )
14- print (f"Unicode string: { repr (unicode_string )} " )
14+ print (f"Architecture: { 'x64' if sys .maxsize > 2 ** 32 else 'x86' } " )
15+ print (f"Unicode string length : { len (unicode_string )} " )
1516
16- # Trigger a warning with Unicode content
17- warnings .warn (f"Test warning with Unicode: { unicode_string } " )
17+ # Process the Unicode data (like the real test does)
18+ result = unicode_string .encode ('utf-8' )
19+ decoded = result .decode ('utf-8' )
20+ assert decoded == unicode_string
21+
22+ # Trigger a warning with Unicode content (this is what causes the crash)
23+ warnings .warn (f"Test warning: { unicode_string } " )
1824
1925 print ("Test completed successfully" )
2026
2127if __name__ == "__main__" :
2228 test_unicode_warning ()
29+
You can’t perform that action at this time.
0 commit comments