Python cffi 模块,__version_info__() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用cffi.__version_info__()

项目:SwiftKitten    作者:johncsnyder    | 项目源码 | 文件源码
def test_opaque_enum(self):
        ffi = FFI(backend=self.Backend())
        ffi.cdef("enum foo;")
        from cffi import __version_info__
        if __version_info__ < (1, 6):
            py.test.skip("re-enable me in version 1.6")
        e = py.test.raises(CDefError, ffi.cast, "enum foo", -1)
        assert str(e.value) == (
            "'enum foo' has no values explicitly defined: refusing to guess "
            "which integer type it is meant to be (unsigned/signed, int/long)")
项目:SwiftKitten    作者:johncsnyder    | 项目源码 | 文件源码
def test_version():
    v = cffi.__version__
    version_info = '.'.join(str(i) for i in cffi.__version_info__)
    version_info = version_info.replace('.beta.', 'b')
    version_info = version_info.replace('.plus', '+')
    assert v == version_info
    #v = BACKEND_VERSIONS.get(v, v)
    assert v == _cffi_backend.__version__