[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security/tests - test_Proxy.py:1.1.2.17
Guido van Rossum
guido@python.org
Fri, 26 Apr 2002 15:13:42 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv8685
Modified Files:
Tag: SecurityProxy-branch
test_Proxy.py
Log Message:
Don't run the two subtests of test_coerce that fail with a
less-than-bleeding-edge CVS Python unless Python 2.3 is detected.
(This means that if you are using CVS Python the test will fail unless
you did a CVS update and rebuilt recently -- but if you're using
Python 2.2 or 2.2.1, you won't be disturbed by a test that can't
succeed.)
=== Zope3/lib/python/Zope/Security/tests/test_Proxy.py 1.1.2.16 => 1.1.2.17 ===
P = self.c.proxy
+ # Before 2.3, coerce() of two proxies returns them unchanged
+ import sys
+ fixed_coerce = sys.version_info >= (2, 3, 0)
+
x = P(1)
y = P(2)
a, b = coerce(x, y)
@@ -267,14 +271,16 @@
x = P(1)
y = P(2.1)
a, b = coerce(x, y)
- # XXX This fails unless your Python is the latest from CVS!!!
- # XXX (PyNumber_Coerce[Ex] needs a change)
- self.failUnless(type(getObject(a)) is float and b is y)
+ self.failUnless(getObject(a) == 1.0 and b is y)
+ if fixed_coerce:
+ self.failUnless(type(getObject(a)) is float and b is y)
x = P(1.1)
y = P(2)
a, b = coerce(x, y)
- self.failUnless(a is x and type(getObject(b)) is float)
+ self.failUnless(a is x and getObject(b) == 2.0)
+ if fixed_coerce:
+ self.failUnless(a is x and type(getObject(b)) is float)
x = P(1)
y = 2