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

Method test_pathext_with_null_extension

Lib/test/test_shutil.py:2559–2575  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2557
2558 @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows')
2559 def test_pathext_with_null_extension(self):
2560 cmd = self.to_text_type(TESTFN2)
2561 cmddot = cmd + self.to_text_type('.')
2562 filepath = os.path.join(self.dir, cmd)
2563 self.create_file(filepath)
2564 with os_helper.EnvironmentVarGuard() as env:
2565 env['PATHEXT'] = '.xyz'
2566 self.assertIsNone(shutil.which(cmd, path=self.dir))
2567 self.assertIsNone(shutil.which(cmddot, path=self.dir))
2568 env['PATHEXT'] = '.xyz;.' # note the .
2569 self.assertEqual(shutil.which(cmd, path=self.dir), filepath)
2570 self.assertEqual(shutil.which(cmddot, path=self.dir),
2571 filepath + self.to_text_type('.'))
2572 env['PATHEXT'] = '.xyz;..' # multiple dots
2573 self.assertEqual(shutil.which(cmd, path=self.dir), filepath)
2574 self.assertEqual(shutil.which(cmddot, path=self.dir),
2575 filepath + self.to_text_type('.'))
2576
2577 @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows')
2578 def test_pathext_extension_ends_with_dot(self):

Callers

nothing calls this directly

Calls 4

create_fileMethod · 0.95
assertIsNoneMethod · 0.80
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected