mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Merged revisions 77763 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77763 | eric.smith | 2010-01-26 19:28:29 -0500 (Tue, 26 Jan 2010) | 1 line Issue #7766: Change sys.getwindowsversion() return value to a named tuple and add the additional members returned in an OSVERSIONINFOEX structure. The new members are service_pack_major, service_pack_minor, suite_mask, and product_type. ........
This commit is contained in:
parent
38f0033601
commit
f7bb57875a
4 changed files with 114 additions and 19 deletions
|
|
@ -5,6 +5,7 @@ import struct
|
|||
import subprocess
|
||||
import textwrap
|
||||
import warnings
|
||||
import operator
|
||||
|
||||
# count the number of test runs, used to create unique
|
||||
# strings to intern in test_intern()
|
||||
|
|
@ -227,13 +228,28 @@ class SysModuleTest(unittest.TestCase):
|
|||
def test_getwindowsversion(self):
|
||||
if hasattr(sys, "getwindowsversion"):
|
||||
v = sys.getwindowsversion()
|
||||
self.assertIsInstance(v, tuple)
|
||||
self.assertTrue(isinstance(v[:], tuple))
|
||||
self.assertEqual(len(v), 5)
|
||||
self.assertIsInstance(v[0], int)
|
||||
self.assertIsInstance(v[1], int)
|
||||
self.assertIsInstance(v[2], int)
|
||||
self.assertIsInstance(v[3], int)
|
||||
self.assertIsInstance(v[4], str)
|
||||
self.assertRaises(IndexError, operator.getitem, v, 5)
|
||||
self.assertIsInstance(v.major, int)
|
||||
self.assertIsInstance(v.minor, int)
|
||||
self.assertIsInstance(v.build, int)
|
||||
self.assertIsInstance(v.platform, int)
|
||||
self.assertIsInstance(v.service_pack, str)
|
||||
self.assertEqual(v[0], v.major)
|
||||
self.assertEqual(v[1], v.minor)
|
||||
self.assertEqual(v[2], v.build)
|
||||
self.assertEqual(v[3], v.platform)
|
||||
self.assertEqual(v[4], v.service_pack)
|
||||
|
||||
# This is how platform.py calls it. Make sure tuple
|
||||
# still has 5 elements
|
||||
maj, min, buildno, plat, csd = sys.getwindowsversion()
|
||||
|
||||
def test_call_tracing(self):
|
||||
self.assertRaises(TypeError, sys.call_tracing, type, 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue