Skip to content

Commit c69d1c4

Browse files
committed
Add a rudimentary test for the platform module that at least calls each
documented function once.
1 parent e5a7fad commit c69d1c4

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

Lib/test/test_platform.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import unittest
2+
from test import test_support
3+
import platform
4+
5+
class PlatformTest(unittest.TestCase):
6+
def test_architecture(self):
7+
res = platform.architecture()
8+
9+
def test_machine(self):
10+
res = platform.machine()
11+
12+
def test_node(self):
13+
res = platform.node()
14+
15+
def test_platform(self):
16+
for aliased in (False, True):
17+
for terse in (False, True):
18+
res = platform.platform(aliased, terse)
19+
20+
def test_processor(self):
21+
res = platform.processor()
22+
23+
def test_python_build(self):
24+
res = platform.python_build()
25+
26+
def test_python_compiler(self):
27+
res = platform.python_compiler()
28+
29+
def test_version(self):
30+
res1 = platform.version()
31+
res2 = platform.version_tuple()
32+
self.assertEqual(res1, ".".join(res2))
33+
34+
def test_release(self):
35+
res = platform.release()
36+
37+
def test_system(self):
38+
res = platform.system()
39+
40+
def test_version(self):
41+
res = platform.version()
42+
43+
def test_system_alias(self):
44+
res = platform.system_alias(
45+
platform.system(),
46+
platform.release(),
47+
platform.version(),
48+
)
49+
50+
def test_uname(self):
51+
res = platform.uname()
52+
53+
def test_java_ver(self):
54+
res = platform.java_ver()
55+
56+
def test_win32_ver(self):
57+
res = platform.win32_ver()
58+
59+
def test_mac_ver(self):
60+
res = platform.mac_ver()
61+
62+
def test_dist(self):
63+
res = platform.dist()
64+
65+
def test_libc_ver(self):
66+
res = platform.libc_ver()
67+
68+
def test_main():
69+
test_support.run_unittest(
70+
PlatformTest
71+
)
72+
73+
if __name__ == '__main__':
74+
test_main()

0 commit comments

Comments
 (0)