importfrom.pyx 1.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
__doc__ = u"""
>>> from distutils import cmd, core, version
>>> import1() == (cmd, core, version)
True
>>> import2() == (cmd, core, version)
True
>>> import3() == (cmd, core, version)
True
>>> import4() == (cmd, core, version)
True
11 12 13 14 15
>>> typed_imports()
True
True
an integer is required
Expected tuple, got int
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
"""

def import1():
    from distutils import (

        cmd,

core,                    version)
    return cmd, core, version


def import2():
    from distutils import (cmd,

core,


                           version
)
    return cmd, core, version


def import3():
    from distutils import (cmd, core,version)
    return cmd, core, version

def import4():
    from distutils import cmd, core, version
    return cmd, core, version
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68



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