1 # Run tests for functions in Python/fileutils.c.
2
3 import os
4 import os.path
5 import unittest
6 from test.support import import_helper
7
8 # Skip this test if the _testcapi module isn't available.
9 _testcapi = import_helper.import_module('_testinternalcapi')
10
11
12 class ESC[4;38;5;81mPathTests(ESC[4;38;5;149munittestESC[4;38;5;149m.ESC[4;38;5;149mTestCase):
13
14 def test_capi_normalize_path(self):
15 if os.name == 'nt':
16 raise unittest.SkipTest('Windows has its own helper for this')
17 else:
18 from test.test_posixpath import PosixPathTest as posixdata
19 tests = posixdata.NORMPATH_CASES
20 for filename, expected in tests:
21 if not os.path.isabs(filename):
22 continue
23 with self.subTest(filename):
24 result = _testcapi.normalize_path(filename)
25 self.assertEqual(result, expected,
26 msg=f'input: {filename!r} expected output: {expected!r}')
27
28
29 if __name__ == "__main__":
30 unittest.main()