Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions extra_tests/snippets/stdlib_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,26 +505,3 @@ def __exit__(self, exc_type, exc_val, exc_tb):

for arg in [None, 1, 1.0, TabError]:
assert_raises(TypeError, os.system, arg)

if sys.platform.startswith("win"):
winver = sys.getwindowsversion()

# the biggest value of wSuiteMask (https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa#members).
all_masks = 0x00000004 | 0x00000400 | 0x00004000 | 0x00000080 | 0x00000002 | 0x00000040 | 0x00000200 | \
0x00000100 | 0x00000001 | 0x00000020 | 0x00002000 | 0x00000010 | 0x00008000 | 0x00020000

# We really can't test if the results are correct, so it just checks for meaningful value
assert winver.major > 0
assert winver.minor >= 0
assert winver.build > 0
assert winver.platform == 2
assert isinstance(winver.service_pack, str)
assert 0 <= winver.suite_mask <= all_masks
assert 1 <= winver.product_type <= 3

# XXX if platform_version is implemented correctly, this'll break on compatiblity mode or a build without manifest
assert winver.major == winver.platform_version[0]
assert winver.minor == winver.platform_version[1]
assert winver.build == winver.platform_version[2]


31 changes: 27 additions & 4 deletions extra_tests/snippets/stdlib_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def demo(x):
assert sys.exc_info() == (None, None, None)

try:
1/0
1/0
except ZeroDivisionError as exc:
exc_info = sys.exc_info()
assert exc_info[0] == type(exc) == ZeroDivisionError
assert exc_info[1] == exc
exc_info = sys.exc_info()
assert exc_info[0] == type(exc) == ZeroDivisionError
assert exc_info[1] == exc


# Recursion:
Expand All @@ -69,3 +69,26 @@ def recursive_call(n):

with assert_raises(RecursionError):
recursive_call(300)

if sys.platform.startswith("win"):
winver = sys.getwindowsversion()
print(f'winver: {winver} {winver.platform_version}')

# the biggest value of wSuiteMask (https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa#members).
all_masks = 0x00000004 | 0x00000400 | 0x00004000 | 0x00000080 | 0x00000002 | 0x00000040 | 0x00000200 | \
0x00000100 | 0x00000001 | 0x00000020 | 0x00002000 | 0x00000010 | 0x00008000 | 0x00020000

# We really can't test if the results are correct, so it just checks for meaningful value
assert winver.major > 0
assert winver.minor >= 0
assert winver.build > 0
assert winver.platform == 2
assert isinstance(winver.service_pack, str)
assert 0 <= winver.suite_mask <= all_masks
assert 1 <= winver.product_type <= 3

# XXX if platform_version is implemented correctly, this'll break on compatiblity mode or a build without manifest
# these fields can mismatch in CPython
# assert winver.major == winver.platform_version[0]
# assert winver.minor == winver.platform_version[1]
# assert winver.build == winver.platform_version[2]