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

Method test_getshortpathname

Lib/test/test_winapi.py:115–127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

113 self.assertIn(pathlib.Path(actual), candidates)
114
115 def test_getshortpathname(self):
116 testfn = pathlib.Path(os.getenv("ProgramFiles"))
117 if not os.path.isdir(testfn):
118 raise unittest.SkipTest("require '%ProgramFiles%' to test")
119
120 # pathlib.Path will be rejected - only str is accepted
121 with self.assertRaises(TypeError):
122 _winapi.GetShortPathName(testfn)
123
124 actual = _winapi.GetShortPathName(os.fsdecode(testfn))
125
126 # Should contain "PROGRA~" but we can't predict the number
127 self.assertIsNotNone(re.match(r".\:\\PROGRA~\d", actual.upper()), actual)
128
129 def test_namedpipe(self):
130 pipe_name = rf"\\.\pipe\LOCAL\{os_helper.TESTFN}"

Callers

nothing calls this directly

Calls 5

assertIsNotNoneMethod · 0.80
isdirMethod · 0.45
assertRaisesMethod · 0.45
matchMethod · 0.45
upperMethod · 0.45

Tested by

no test coverage detected