MCPcopy Index your code
hub / github.com/python/cpython / test_wmi_query_os_version

Method test_wmi_query_os_version

Lib/test/test_wmi.py:28–36  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26
27class WmiTests(unittest.TestCase):
28 def test_wmi_query_os_version(self):
29 r = wmi_exec_query("SELECT Version FROM Win32_OperatingSystem").split("\0")
30 self.assertEqual(1, len(r))
31 k, eq, v = r[0].partition("=")
32 self.assertEqual("=", eq, r[0])
33 self.assertEqual("Version", k, r[0])
34 # Best we can check for the version is that it's digits, dot, digits, anything
35 # Otherwise, we are likely checking the result of the query against itself
36 self.assertRegex(v, r"\d+\.\d+.+$", r[0])
37
38 def test_wmi_query_repeated(self):
39 # Repeated queries should not break

Callers 1

Calls 5

wmi_exec_queryFunction · 0.85
assertRegexMethod · 0.80
splitMethod · 0.45
assertEqualMethod · 0.45
partitionMethod · 0.45

Tested by

no test coverage detected