summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-01-28 03:57:39 (GMT)
committerFred Drake <fdrake@acm.org>2001-01-28 03:57:39 (GMT)
commit64d42c5bb12a38e9a2c71ccc3570bcd7ba46a943 (patch)
tree1bc3a2748ff212a93e2862fc0331102a85ae1893 /Lib
parentceb2bff09ee06304ce4d2c49ecd79bac7fd84298 (diff)
downloadcpython-64d42c5bb12a38e9a2c71ccc3570bcd7ba46a943.zip
cpython-64d42c5bb12a38e9a2c71ccc3570bcd7ba46a943.tar.gz
cpython-64d42c5bb12a38e9a2c71ccc3570bcd7ba46a943.tar.bz2
Added tests for new signature of new.instance().
Use test_support.verify() where applicable.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_new.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/Lib/test/test_new.py b/Lib/test/test_new.py
index af26f01..30433ae 100644
--- a/Lib/test/test_new.py
+++ b/Lib/test/test_new.py
@@ -1,4 +1,4 @@
-from test_support import verbose
+from test_support import verbose, verify
import sys
import new
@@ -25,6 +25,14 @@ print 'new.instance()'
c = new.instance(C, {'yolks': 3})
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):
self.yolks = self.yolks - 2
@@ -33,11 +41,11 @@ im = new.instancemethod(break_yolks, c, C)
if verbose:
print im
-if c.get_yolks() != 3 and c.get_more_yolks() != 6:
- print 'Broken call of hand-crafted class instance'
+verify(c.get_yolks() == 3 and c.get_more_yolks() == 6,
+ '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'
+verify(c.get_yolks() == 1 and c.get_more_yolks() == 4,
+ 'Broken call of hand-crafted instance method')
codestr = '''
a = 1
@@ -53,8 +61,8 @@ func = new.function(ccode, g)
if verbose:
print func
func()
-if g['c'] != 3:
- print 'Could not create a proper function object'
+verify(g['c'] == 3,
+ 'Could not create a proper function object')
# bogus test of new.code()
print 'new.code()'