diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-07-04 19:45:06 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-07-04 19:45:06 (GMT) |
commit | ba78bc4a3216b51398bab59157572a51c38b9ef4 (patch) | |
tree | d151f2cebb63e2d44505dafaeada1331b6ff134d | |
parent | 8b7f131f8b4d5a6643f74690f07ed226f5640bc7 (diff) | |
download | cpython-ba78bc4a3216b51398bab59157572a51c38b9ef4.zip cpython-ba78bc4a3216b51398bab59157572a51c38b9ef4.tar.gz cpython-ba78bc4a3216b51398bab59157572a51c38b9ef4.tar.bz2 |
printlist(): Replaced the guts with a call to textwrap. Yay!
-rwxr-xr-x | Lib/test/regrtest.py | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 77ae9c5..a586225 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -464,21 +464,10 @@ def printlist(x, width=70, indent=4): begin each line. """ - line = ' ' * indent - for one in map(str, x): - w = len(line) + len(one) - if line[-1:] == ' ': - pad = '' - else: - pad = ' ' - w += 1 - if w > width: - print line - line = ' ' * indent + one - else: - line += pad + one - if len(line) > indent: - print line + from textwrap import fill + blanks = ' ' * indent + print fill(' '.join(map(str, x)), width, + initial_indent=blanks, subsequent_indent=blanks) class _Set: def __init__(self, seq=[]): @@ -723,27 +712,27 @@ _expectations = { """, 'atheos': """ - test_al - test_cd - test_cl - test_curses - test_dl + test_al + test_cd + test_cl + test_curses + test_dl test_email_codecs - test_gdbm - test_gl - test_imgfile - test_largefile + test_gdbm + test_gl + test_imgfile + test_largefile test_linuxaudiodev - test_locale + test_locale test_mhlib - test_mmap - test_mpz - test_nis + test_mmap + test_mpz + test_nis test_poll test_popen2 test_resource - test_socket_ssl - test_socketserver + test_socket_ssl + test_socketserver test_sunaudiodev test_unicode_file test_winreg |