From 117a5caf806aae2ee1219b87ea44ba338efaac46 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 17 Jul 2010 16:35:09 +0200 Subject: [PATCH] test fix for Py<2.5 --- tests/run/withstat.pyx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/run/withstat.pyx b/tests/run/withstat.pyx index ff6eb5ec..bea6437e 100644 --- a/tests/run/withstat.pyx +++ b/tests/run/withstat.pyx @@ -1,8 +1,15 @@ from __future__ import with_statement +import sys def typename(t): - return u"" % type(t).__name__ + name = type(t).__name__ + if sys.version_info < (2,5): + if name == 'classobj' and issubclass(t, MyException): + name = 'type' + elif name == 'instance' and isinstance(t, MyException): + name = 'MyException' + return u"" % name class MyException(Exception): pass -- 2.26.2