mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
fix the length of platform.uname_result (#13068)
It should be a 6-tuple, once processor is added. This makes sure mypy understands that. Fixes https://github.com/python/typeshed/issues/13064
This commit is contained in:
19
stdlib/@tests/test_cases/check_platform.py
Normal file
19
stdlib/@tests/test_cases/check_platform.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import platform
|
||||
import sys
|
||||
from typing_extensions import assert_type
|
||||
|
||||
# platform.uname_result emulates a 6 field named tuple, but on 3.9+ the processor
|
||||
# field is lazily evaluated, which results in it being a little funky.
|
||||
uname = platform.uname()
|
||||
if sys.version_info >= (3, 9):
|
||||
myuname = platform.uname_result("Darwin", "local", "22.5.0", "Darwin Kernel Version 22.5.0", "arm64")
|
||||
else:
|
||||
myuname = platform.uname_result("Darwin", "local", "22.5.0", "Darwin Kernel Version 22.5.0", "arm64", "arm")
|
||||
|
||||
assert_type(uname, platform.uname_result)
|
||||
assert_type(myuname, platform.uname_result)
|
||||
|
||||
assert_type(uname[5], str)
|
||||
assert_type(myuname[5], str)
|
||||
Reference in New Issue
Block a user