Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: Lib/test/test_curses.py

Issue 3871: cross and native build of python for mingw32 with distutils
Patch Set: Created 7 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_capi.py ('k') | Lib/test/test_os.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 1 #
2 # Test script for the curses module 2 # Test script for the curses module
3 # 3 #
4 # This script doesn't actually display anything very coherent. but it 4 # This script doesn't actually display anything very coherent. but it
5 # does call every method and function. 5 # does call every method and function.
6 # 6 #
7 # Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(), 7 # Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(),
8 # init_color() 8 # init_color()
9 # Only called, not tested: getmouse(), ungetmouse() 9 # Only called, not tested: getmouse(), ungetmouse()
10 # 10 #
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 curses.reset_prog_mode, curses.termattrs, 162 curses.reset_prog_mode, curses.termattrs,
163 curses.termname, curses.erasechar, curses.getsyx]: 163 curses.termname, curses.erasechar, curses.getsyx]:
164 func() 164 func()
165 165
166 # Functions that actually need arguments 166 # Functions that actually need arguments
167 if curses.tigetstr("cnorm"): 167 if curses.tigetstr("cnorm"):
168 curses.curs_set(1) 168 curses.curs_set(1)
169 curses.delay_output(1) 169 curses.delay_output(1)
170 curses.echo() ; curses.echo(1) 170 curses.echo() ; curses.echo(1)
171 171
172 f = tempfile.TemporaryFile() 172 fx = tempfile.TemporaryFile()
173 # cf tempfile.py TemporaryFile vs NamedTemporaryFile
174 if os.name != 'posix' or os.sys.platform == 'cygwin':
175 f = fx.file
176 else:
177 f = fx
173 stdscr.putwin(f) 178 stdscr.putwin(f)
174 f.seek(0) 179 f.seek(0)
175 curses.getwin(f) 180 curses.getwin(f)
176 f.close() 181 fx.close()
177 182
178 curses.halfdelay(1) 183 curses.halfdelay(1)
179 curses.intrflush(1) 184 curses.intrflush(1)
180 curses.meta(1) 185 curses.meta(1)
181 curses.napms(100) 186 curses.napms(100)
182 curses.newpad(50,50) 187 curses.newpad(50,50)
183 win = curses.newwin(5,5) 188 win = curses.newwin(5,5)
184 win = curses.newwin(5,5, 1,1) 189 win = curses.newwin(5,5, 1,1)
185 curses.nl() ; curses.nl(1) 190 curses.nl() ; curses.nl(1)
186 curses.putp(b'abc') 191 curses.putp(b'abc')
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 if read != ch: 287 if read != ch:
283 raise AssertionError("%r != %r" % (read, ch)) 288 raise AssertionError("%r != %r" % (read, ch))
284 289
285 code = ord(ch) 290 code = ord(ch)
286 curses.unget_wch(code) 291 curses.unget_wch(code)
287 read = stdscr.get_wch() 292 read = stdscr.get_wch()
288 if read != ch: 293 if read != ch:
289 raise AssertionError("%r != %r" % (read, ch)) 294 raise AssertionError("%r != %r" % (read, ch))
290 295
291 def test_issue10570(): 296 def test_issue10570():
292 b = curses.tparm(curses.tigetstr("cup"), 5, 3) 297 cap = curses.tigetstr("cup")
298 # return if cup capability is not supported
299 if cap is None:
300 return
301 b = curses.tparm(cap, 5, 3)
293 assert type(b) is bytes 302 assert type(b) is bytes
294 curses.putp(b) 303 curses.putp(b)
295 304
296 def test_encoding(stdscr): 305 def test_encoding(stdscr):
297 import codecs 306 import codecs
298 encoding = stdscr.encoding 307 encoding = stdscr.encoding
299 codecs.lookup(encoding) 308 codecs.lookup(encoding)
300 try: 309 try:
301 stdscr.encoding = 10 310 stdscr.encoding = 10
302 except TypeError: 311 except TypeError:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 try: 343 try:
335 stdscr = curses.initscr() 344 stdscr = curses.initscr()
336 main(stdscr) 345 main(stdscr)
337 finally: 346 finally:
338 curses.endwin() 347 curses.endwin()
339 unit_tests() 348 unit_tests()
340 349
341 if __name__ == '__main__': 350 if __name__ == '__main__':
342 curses.wrapper(main) 351 curses.wrapper(main)
343 unit_tests() 352 unit_tests()
OLDNEW
« no previous file with comments | « Lib/test/test_capi.py ('k') | Lib/test/test_os.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+