python svn模块_Python sys 模块,subversion() 实例源码 - 编程字典

def test_sys_version(self):

# Old test.

for input, output in (

('2.4.3 (#1, Jun 21 2006, 13:54:21)\n[GCC 3.3.4 (pre 3.3.5 20040809)]',

('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),

('IronPython 1.0.60816 on .NET 2.0.50727.42',

('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),

('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',

('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),

):

# branch and revision are not "parsed", but fetched

# from sys.subversion. Ignore them

(name, version, branch, revision, buildno, builddate, compiler) \

= platform._sys_version(input)

self.assertEqual(

(name, version, '', '', buildno, builddate, compiler), output)

# Tests for python_implementation(), python_version(), python_branch(),

# python_revision(), python_build(), and python_compiler().

sys_versions = {

("2.6.1 (r261:67515, Dec 6 2008, 15:26:00)\n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]",

('CPython', 'tags/r261', '67515'), self.save_platform)

:

("CPython", "2.6.1", "tags/r261", "67515",

('r261:67515', 'Dec 6 2008 15:26:00'),

'GCC 4.0.1 (Apple Computer, Inc. build 5370)'),

("IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053", None, "cli")

:

("IronPython", "2.0.0", "", "", ("", ""),

".NET 2.0.50727.3053"),

("2.5 (trunk:6107, Mar 26 2009, 13:02:18)\n[Java HotSpot(TM) Client VM (\"Apple Computer, Inc.\")]",

('Jython', 'trunk', '6107'), "java1.5.0_16")

:

("Jython", "2.5.0", "trunk", "6107",

('trunk:6107', 'Mar 26 2009'), "java1.5.0_16"),

("2.5.2 (63378, Mar 26 2009, 18:03:29)\n[PyPy 1.0.0]",

('PyPy', 'trunk', '63378'), self.save_platform)

:

("PyPy", "2.5.2", "trunk", "63378", ('63378', 'Mar 26 2009'),

"")

}

for (version_tag, subversion, sys_platform), info in \

sys_versions.items():

sys.version = version_tag

if subversion is None:

if hasattr(sys, "_mercurial"):

del sys._mercurial

if hasattr(sys, "subversion"):

del sys.subversion

else:

sys._mercurial = subversion

if sys_platform is not None:

sys.platform = sys_platform

self.assertEqual(platform.python_implementation(), info[0])

self.assertEqual(platform.python_version(), info[1])

self.assertEqual(platform.python_branch(), info[2])

self.assertEqual(platform.python_revision(), info[3])

self.assertEqual(platform.python_build(), info[4])

self.assertEqual(platform.python_compiler(), info[5])

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值