[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.14,1.1.2.15
Guido van Rossum
gvanrossum@users.sourceforge.net
Mon, 18 Jun 2001 06:40:17 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv9860
Modified Files:
Tag: descr-branch
test_descr.py
Log Message:
Add tests for behavior of object().
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -C2 -r1.1.2.14 -r1.1.2.15
*** test_descr.py 2001/06/17 23:27:27 1.1.2.14
--- test_descr.py 2001/06/18 13:40:15 1.1.2.15
***************
*** 413,416 ****
--- 413,438 ----
verify(G.__mro__ == (G, E, D, C, B, A, object))
+ def objects():
+ if verbose: print "Testing 'object' class..."
+ # Not much to test here :-)
+ a = object()
+ verify(a.__class__ == object == type(a))
+ b = object()
+ verify(a is not b)
+
+ try:
+ object().foo
+ except AttributeError:
+ pass
+ else:
+ print "Ouch: object() should not have a foo attribute!"
+
+ try:
+ object().foo = 12
+ except AttributeError:
+ pass
+ else:
+ print "Ouch: object() should not allow setting a foo attribute!"
+
def errors():
if verbose: print "Testing errors..."
***************
*** 471,474 ****
--- 493,497 ----
multi()
diamond()
+ objects()
errors()