summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_platform.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-05-09 14:12:41 (GMT)
committerGitHub <noreply@github.com>2020-05-09 14:12:41 (GMT)
commit2c3d508c5fabe40dac848fb9ae558069f0576879 (patch)
treea0075079dfef0b4f68bc1492a6ef6d0d9b3b916f /Lib/test/test_platform.py
parent77c614624b6bf2145bef69830d0f499d8b55ec0c (diff)
downloadcpython-2c3d508c5fabe40dac848fb9ae558069f0576879.zip
cpython-2c3d508c5fabe40dac848fb9ae558069f0576879.tar.gz
cpython-2c3d508c5fabe40dac848fb9ae558069f0576879.tar.bz2
bpo-40570: Improve compatibility of uname_result with late-bound .platform (#20015)
* bpo-40570: Improve compatibility of uname_result with late-bound .platform. * Add test capturing ability to cast uname to a tuple.
Diffstat (limited to 'Lib/test/test_platform.py')
-rw-r--r--Lib/test/test_platform.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 7664b38..a5c35df 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -154,11 +154,26 @@ class PlatformTest(unittest.TestCase):
res = platform.uname()
self.assertTrue(any(res))
self.assertEqual(res[0], res.system)
+ self.assertEqual(res[-6], res.system)
self.assertEqual(res[1], res.node)
+ self.assertEqual(res[-5], res.node)
self.assertEqual(res[2], res.release)
+ self.assertEqual(res[-4], res.release)
self.assertEqual(res[3], res.version)
+ self.assertEqual(res[-3], res.version)
self.assertEqual(res[4], res.machine)
+ self.assertEqual(res[-2], res.machine)
self.assertEqual(res[5], res.processor)
+ self.assertEqual(res[-1], res.processor)
+ self.assertEqual(len(res), 6)
+
+ def test_uname_cast_to_tuple(self):
+ res = platform.uname()
+ expected = (
+ res.system, res.node, res.release, res.version, res.machine,
+ res.processor,
+ )
+ self.assertEqual(tuple(res), expected)
@unittest.skipIf(sys.platform in ['win32', 'OpenVMS'], "uname -p not used")
def test_uname_processor(self):