MCPcopy Index your code
hub / github.com/python/cpython / test_output_character

Method test_output_character

Lib/test/test_curses.py:255–291  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 self.assertIs(stdscr.is_wintouched(), syncok)
254
255 def test_output_character(self):
256 stdscr = self.stdscr
257 encoding = stdscr.encoding
258 # addch()
259 stdscr.refresh()
260 stdscr.move(0, 0)
261 stdscr.addch('A')
262 stdscr.addch(b'A')
263 stdscr.addch(65)
264 c = '\u20ac'
265 try:
266 stdscr.addch(c)
267 except UnicodeEncodeError:
268 self.assertRaises(UnicodeEncodeError, c.encode, encoding)
269 except OverflowError:
270 encoded = c.encode(encoding)
271 self.assertNotEqual(len(encoded), 1, repr(encoded))
272 stdscr.addch('A', curses.A_BOLD)
273 stdscr.addch(1, 2, 'A')
274 stdscr.addch(2, 3, 'A', curses.A_BOLD)
275 self.assertIs(stdscr.is_wintouched(), True)
276
277 # echochar()
278 stdscr.refresh()
279 stdscr.move(0, 0)
280 stdscr.echochar('A')
281 stdscr.echochar(b'A')
282 stdscr.echochar(65)
283 with self.assertRaises((UnicodeEncodeError, OverflowError)):
284 # Unicode is not fully supported yet, but at least it does
285 # not crash.
286 # It is supposed to fail because either the character is
287 # not encodable with the current encoding, or it is encoded to
288 # a multibyte sequence.
289 stdscr.echochar('\u0114')
290 stdscr.echochar('A', curses.A_BOLD)
291 self.assertIs(stdscr.is_wintouched(), False)
292
293 def test_output_string(self):
294 stdscr = self.stdscr

Callers

nothing calls this directly

Calls 6

assertNotEqualMethod · 0.80
refreshMethod · 0.45
moveMethod · 0.45
assertRaisesMethod · 0.45
encodeMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected