test_magic.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:python-xdis 作者: rocky 项目源码 文件源码
def test_basic(self):
        """Basic test of magic numbers"""
        current = imp.get_magic()
        if hasattr(sys, 'version_info'):
            version = '.'.join([str(v) for v in sys.version_info[0:3]])
            if IS_PYPY:
                version += 'pypy'
            self.assertTrue(version in magics.magics.keys(),
                            "version %s is not in magic.magics.keys: %s" %
                            (version, magics.magics.keys()))

        self.assertEqual(current, magics.int2magic(magics.magic2int(current)))
        lookup = str(PYTHON_VERSION)
        if IS_PYPY:
            lookup += 'pypy'
        self.assertTrue(lookup in magics.magics.keys(),
                        "PYTHON VERSION %s is not in magic.magics.keys: %s" %
                        (lookup, magics.magics.keys()))

        self.assertEqual(magics.sysinfo2magic(), current,
                        "magic from imp.get_magic() should be sysinfo2magic()")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号