@@ -1563,7 +1563,8 @@ def test_env_queries(self):
15631563 self .assertIsInstance (curses .has_ic (), bool )
15641564 self .assertIsInstance (curses .has_il (), bool )
15651565 self .assertIsInstance (curses .termattrs (), int )
1566- self .assertIsInstance (curses .term_attrs (), int )
1566+ if hasattr (curses , 'term_attrs' ):
1567+ self .assertIsInstance (curses .term_attrs (), int )
15671568
15681569 c = curses .killchar ()
15691570 self .assertIsInstance (c , bytes )
@@ -2365,15 +2366,19 @@ def test_textbox_combining(self):
23652366 self .assertEqual (box .gather (), text + ' ' )
23662367
23672368 def test_textbox_edit_wide (self ):
2368- # edit() reads characters through get_wch(). Each is used only if
2369- # encodable in the current locale.
2369+ # edit() reads characters through get_wch(). Each character is pushed
2370+ # with unget_wch(), which on a narrow build requires it to encode to a
2371+ # single byte, so a non-ASCII case needs a wide build or an 8-bit locale.
23702372 for ch in ['A' , 'é' , '¤' , '€' , 'д' ]:
2371- if self ._encodable (ch ):
2372- with self .subTest (ch = ch ):
2373- box , win = self ._make_textbox (1 , 10 )
2374- for c in reversed (['a' , ch , chr (curses .ascii .BEL )]):
2375- curses .unget_wch (c )
2376- self .assertEqual (box .edit (), 'a' + ch + ' ' )
2373+ if not self ._encodable (ch ):
2374+ continue
2375+ if not WIDE_BUILD and len (ch .encode (self .stdscr .encoding )) != 1 :
2376+ continue
2377+ with self .subTest (ch = ch ):
2378+ box , win = self ._make_textbox (1 , 10 )
2379+ for c in reversed (['a' , ch , chr (curses .ascii .BEL )]):
2380+ curses .unget_wch (c )
2381+ self .assertEqual (box .edit (), 'a' + ch + ' ' )
23772382
23782383 def test_textbox_movement (self ):
23792384 box , win = self ._make_textbox (3 , 10 )
0 commit comments