本文整理匯總了Python中sys.subversion方法的典型用法代碼示例。如果您正苦於以下問題:Python sys.subversion方法的具體用法?Python sys.subversion怎麽用?Python sys.subversion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sys
的用法示例。
在下文中一共展示了sys.subversion方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import subversion [as 別名]
def setUp(self):
self.save_version = sys.version
self.save_subversion = sys.subversion
self.save_platform = sys.platform
示例2: tearDown
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import subversion [as 別名]
def tearDown(self):
sys.version = self.save_version
sys.subversion = self.save_subversion
sys.platform = self.save_platform
示例3: _python_version_string
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import subversion [as 別名]
def _python_version_string():
try:
impl = sys.subversion[0]
except AttributeError:
impl = sys.implementation.name
if impl == 'cpython':
impl = 'CPython'
lst = [impl,
'.'.join([str(x) for x in sys.version_info[:3]]),
' '.join([str(x) for x in sys.version_info[3:]])]
return '%s %s %s' % tuple(lst)
示例4: setUp
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import subversion [as 別名]
def setUp(self):
# These are readonly in Jython
if not test_support.is_jython:
self.save_version = sys.version
self.save_subversion = sys.subversion
self.save_platform = sys.platform
示例5: tearDown
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import subversion [as 別名]
def tearDown(self):
# These are readonly in Jython
if not test_support.is_jython:
sys.version = self.save_version
sys.subversion = self.save_subversion
sys.platform = self.save_platform
示例6: test_sys_version
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import subversion [as 別名]
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.iteritems():
sys.version = version_tag
if subversion is None:
if hasattr(sys, "subversion"):
del sys.subversion
else:
sys.subversion = 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])