From dea87f8a201ac6fe27a069fdb2bece988be14126 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 25 Feb 2009 21:13:06 -0800 Subject: [PATCH] Test for typed from...import --- tests/run/importfrom.pyx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/run/importfrom.pyx b/tests/run/importfrom.pyx index e7dbd6d5..65514607 100644 --- a/tests/run/importfrom.pyx +++ b/tests/run/importfrom.pyx @@ -8,6 +8,11 @@ True True >>> import4() == (cmd, core, version) True +>>> typed_imports() +True +True +an integer is required +Expected tuple, got int """ def import1(): @@ -37,3 +42,27 @@ def import3(): def import4(): from distutils import cmd, core, version return cmd, core, version + + + +def typed_imports(): + + import sys + cdef long maxint + cdef tuple t + + from sys import maxint + print maxint == sys.maxint + from sys import version_info as t + print t is sys.version_info + + try: + from sys import version_info as maxint + except TypeError, e: + print e + + try: + from sys import maxint as t + except TypeError, e: + print e + -- 2.26.2