[Python-checkins] python/dist/src/Lib/test test_bool.py,1.3,1.4

loewis@sourceforge.net loewis@sourceforge.net
Sun, 14 Apr 2002 03:22:31 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv29214

Modified Files:
	test_bool.py 
Log Message:
Patch #542569: tp_print tp_repr tp_str in test_bool.py.


Index: test_bool.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_bool.py	5 Apr 2002 20:57:02 -0000	1.3
--- test_bool.py	14 Apr 2002 10:22:29 -0000	1.4
***************
*** 2,5 ****
--- 2,6 ----
  
  from test_support import verbose, TestFailed, TESTFN, vereq
+ import os
  
  def veris(a, b):
***************
*** 26,29 ****
--- 27,47 ----
      raise TestFailed, "should not be able to create new bool instances"
  
+ # checking tp_print slot
+ fo = open(TESTFN, "wb")
+ print >> fo, False, True
+ fo.close()
+ fo = open(TESTFN, "rb")
+ vereq(fo.read(), 'False True\n')
+ fo.close()
+ os.remove(TESTFN)
+ 
+ # checking repr and str
+ vereq(str(False), 'False')
+ vereq(str(True), 'True')
+ vereq(repr(False), 'False')
+ vereq(repr(True), 'True')
+ vereq(eval(repr(False)), False)
+ vereq(eval(repr(True)), True)
+ 
  vereq(int(False), 0)
  verisnot(int(False), False)
***************
*** 186,190 ****
  f.close()
  veris(f.closed, True)
- import os
  os.remove(TESTFN)
  
--- 204,207 ----