summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2005-11-21 17:48:12 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2005-11-21 17:48:12 (GMT)
commitc69d1c498f3896803f78de613a54d17be88bbeaf (patch)
tree07e077cdd82bfad9f9cf6f860e6e64473adddb03 /Lib/test
parente5a7fad356a98f931bbe0d2c9e4b18854510c3dd (diff)
downloadcpython-c69d1c498f3896803f78de613a54d17be88bbeaf.zip
cpython-c69d1c498f3896803f78de613a54d17be88bbeaf.tar.gz
cpython-c69d1c498f3896803f78de613a54d17be88bbeaf.tar.bz2
Add a rudimentary test for the platform module that at least calls each
documented function once.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_platform.py74
1 files changed, 74 insertions, 0 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
new file mode 100644
index 0000000..200fba5
--- /dev/null
+++ b/Lib/test/test_platform.py
@@ -0,0 +1,74 @@
+import unittest
+from test import test_support
+import platform
+
+class PlatformTest(unittest.TestCase):
+ def test_architecture(self):
+ res = platform.architecture()
+
+ def test_machine(self):
+ res = platform.machine()
+
+ def test_node(self):
+ res = platform.node()
+
+ def test_platform(self):
+ for aliased in (False, True):
+ for terse in (False, True):
+ res = platform.platform(aliased, terse)
+
+ def test_processor(self):
+ res = platform.processor()
+
+ def test_python_build(self):
+ res = platform.python_build()
+
+ def test_python_compiler(self):
+ res = platform.python_compiler()
+
+ def test_version(self):
+ res1 = platform.version()
+ res2 = platform.version_tuple()
+ self.assertEqual(res1, ".".join(res2))
+
+ def test_release(self):
+ res = platform.release()
+
+ def test_system(self):
+ res = platform.system()
+
+ def test_version(self):
+ res = platform.version()
+
+ def test_system_alias(self):
+ res = platform.system_alias(
+ platform.system(),
+ platform.release(),
+ platform.version(),
+ )
+
+ def test_uname(self):
+ res = platform.uname()
+
+ def test_java_ver(self):
+ res = platform.java_ver()
+
+ def test_win32_ver(self):
+ res = platform.win32_ver()
+
+ def test_mac_ver(self):
+ res = platform.mac_ver()
+
+ def test_dist(self):
+ res = platform.dist()
+
+ def test_libc_ver(self):
+ res = platform.libc_ver()
+
+def test_main():
+ test_support.run_unittest(
+ PlatformTest
+ )
+
+if __name__ == '__main__':
+ test_main()