[Python-checkins] python/dist/src/Lib/test test_dis.py,1.1,1.2

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年3月07日 07:55:41 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv22717
Modified Files:
	test_dis.py 
Log Message:
This test relied on significant trailing whitespace in a string literal.
Evil.
Index: test_dis.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dis.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_dis.py	27 Feb 2003 21:27:07 -0000	1.1
--- test_dis.py	7 Mar 2003 15:55:36 -0000	1.2
***************
*** 11,26 ****
 # line numbers in dis_f
 def _f(a):
! print a
! return 1
 
 dis_f = """\
 13 0 LOAD_FAST 0 (a)
! 3 PRINT_ITEM 
! 4 PRINT_NEWLINE 
 
 14 5 LOAD_CONST 1 (1)
! 8 RETURN_VALUE 
 9 LOAD_CONST 0 (None)
! 12 RETURN_VALUE 
 """
 
--- 11,26 ----
 # line numbers in dis_f
 def _f(a):
! print a
! return 1
 
 dis_f = """\
 13 0 LOAD_FAST 0 (a)
! 3 PRINT_ITEM
! 4 PRINT_NEWLINE
 
 14 5 LOAD_CONST 1 (1)
! 8 RETURN_VALUE
 9 LOAD_CONST 0 (None)
! 12 RETURN_VALUE
 """
 
***************
*** 44,48 ****
 dis.dis(_f)
 sys.stdout = save_stdout
! self.assertEqual(dis_f, s.getvalue())
 
 def test_main():
--- 44,53 ----
 dis.dis(_f)
 sys.stdout = save_stdout
! got = s.getvalue()
! # Trim trailing blanks (if any).
! lines = got.split('\n')
! lines = [line.rstrip() for line in lines]
! got = '\n'.join(lines)
! self.assertEqual(dis_f, got)
 
 def test_main():

AltStyle によって変換されたページ (->オリジナル) /