MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_getshortpathname

Method test_getshortpathname

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected