[Python-checkins] CVS: python/dist/src/Lib/test test_new.py,1.9,1.10
Fred L. Drake
fdrake@users.sourceforge.net
Sat, 27 Jan 2001 19:57:41 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv15200/Lib/test
Modified Files:
test_new.py
Log Message:
Added tests for new signature of new.instance().
Use test_support.verify() where applicable.
Index: test_new.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_new.py 2001/01/25 20:12:27 1.9
--- test_new.py 2001/01/28 03:57:39 1.10
***************
*** 1,3 ****
! from test_support import verbose
import sys
import new
--- 1,3 ----
! from test_support import verbose, verify
import sys
import new
***************
*** 26,29 ****
--- 26,37 ----
if verbose:
print c
+ o = new.instance(C)
+ verify(o.__dict__ == {},
+ "new __dict__ should be empty")
+ del o
+ o = new.instance(C, None)
+ verify(o.__dict__ == {},
+ "new __dict__ should be empty")
+ del o
def break_yolks(self):
***************
*** 34,42 ****
print im
! if c.get_yolks() != 3 and c.get_more_yolks() != 6:
! print 'Broken call of hand-crafted class instance'
im()
! if c.get_yolks() != 1 and c.get_more_yolks() != 4:
! print 'Broken call of hand-crafted instance method'
codestr = '''
--- 42,50 ----
print im
! verify(c.get_yolks() == 3 and c.get_more_yolks() == 6,
! 'Broken call of hand-crafted class instance')
im()
! verify(c.get_yolks() == 1 and c.get_more_yolks() == 4,
! 'Broken call of hand-crafted instance method')
codestr = '''
***************
*** 54,59 ****
print func
func()
! if g['c'] != 3:
! print 'Could not create a proper function object'
# bogus test of new.code()
--- 62,67 ----
print func
func()
! verify(g['c'] == 3,
! 'Could not create a proper function object')
# bogus test of new.code()