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

Method test_output_string

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

Source from the content-addressed store, hash-verified

291 self.assertIs(stdscr.is_wintouched(), False)
292
293 def test_output_string(self):
294 stdscr = self.stdscr
295 encoding = stdscr.encoding
296 # addstr()/insstr()
297 for func in [stdscr.addstr, stdscr.insstr]:
298 with self.subTest(func.__qualname__):
299 stdscr.move(0, 0)
300 func('abcd')
301 func(b'abcd')
302 s = 'àßçđ'
303 try:
304 func(s)
305 except UnicodeEncodeError:
306 self.assertRaises(UnicodeEncodeError, s.encode, encoding)
307 func('abcd', curses.A_BOLD)
308 func(1, 2, 'abcd')
309 func(2, 3, 'abcd', curses.A_BOLD)
310
311 # addnstr()/insnstr()
312 for func in [stdscr.addnstr, stdscr.insnstr]:
313 with self.subTest(func.__qualname__):
314 stdscr.move(0, 0)
315 func('1234', 3)
316 func(b'1234', 3)
317 s = '\u0661\u0662\u0663\u0664'
318 try:
319 func(s, 3)
320 except UnicodeEncodeError:
321 self.assertRaises(UnicodeEncodeError, s.encode, encoding)
322 func('1234', 5)
323 func('1234', 3, curses.A_BOLD)
324 func(1, 2, '1234', 3)
325 func(2, 3, '1234', 3, curses.A_BOLD)
326
327 def test_output_string_embedded_null_chars(self):
328 # reject embedded null bytes and characters

Callers

nothing calls this directly

Calls 4

funcFunction · 0.70
subTestMethod · 0.45
moveMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected