[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5279 - trunk/gnue-common/src/apps
From: |
reinhard |
Subject: |
r5279 - trunk/gnue-common/src/apps |
Date: |
Tue, 9 Mar 2004 11:51:30 -0600 (CST) |
Author: reinhard
Date: 2004-03-09 11:51:28 -0600 (Tue, 09 Mar 2004)
New Revision: 5279
Modified:
trunk/gnue-common/src/apps/checktype.py
Log:
Minor fixes.
Modified: trunk/gnue-common/src/apps/checktype.py
===================================================================
--- trunk/gnue-common/src/apps/checktype.py 2004-03-09 12:41:26 UTC (rev
5278)
+++ trunk/gnue-common/src/apps/checktype.py 2004-03-09 17:51:28 UTC (rev
5279)
@@ -55,7 +55,12 @@
self.varname = k
self.expected = expected # Expected type of variable
- self.actual = type (variable) # Actual type of variable
+
+ if isinstance (variable, InstanceType):
+ self.actual = variable.__class__
+ else:
+ self.actual = type (variable) # Actual type of variable
+
self.value = variable # Value of variable
message = _(
@@ -79,7 +84,7 @@
else:
if isinstance (variable, validtype):
return
- raise TypeError (variable, validtype)
+ raise TypeError, (variable, validtype)
# -----------------------------------------------------------------------------
# Module initialization
@@ -99,8 +104,8 @@
def mustfail (testvar, validtype):
try:
checktype (testvar, validtype)
- except TypeError:
- print sys.exc_info () [1]
+ except TypeError, message:
+ print message
return
raise Error ("checking %s as %s hasn't failed!" % (repr (variable),
repr (validtype)))
@@ -138,7 +143,7 @@
mustfail (s, UnicodeType)
mustfail (u, StringType)
mustfail (i, FloatType)
- mustfail (f, IntType)
+ mustfail (o, IntType)
mustfail (c, c)
print 'Multiple types, failure ...'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5279 - trunk/gnue-common/src/apps,
reinhard <=