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

Method _do_single

Lib/test/test_unicode_file.py:31–54  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

29 # Do all the tests we can given only a single filename. The file should
30 # exist.
31 def _do_single(self, filename):
32 self.assertTrue(os.path.exists(filename))
33 self.assertTrue(os.path.isfile(filename))
34 self.assertTrue(os.access(filename, os.R_OK))
35 self.assertTrue(os.path.exists(os.path.abspath(filename)))
36 self.assertTrue(os.path.isfile(os.path.abspath(filename)))
37 self.assertTrue(os.access(os.path.abspath(filename), os.R_OK))
38 os.chmod(filename, 0o777)
39 os.utime(filename, None)
40 os.utime(filename, (time.time(), time.time()))
41 # Copy/rename etc tests using the same filename
42 self._do_copyish(filename, filename)
43 # Filename should appear in glob output
44 self.assertTrue(
45 os.path.abspath(filename)==os.path.abspath(glob.glob(glob.escape(filename))[0]))
46 # basename should appear in listdir.
47 path, base = os.path.split(os.path.abspath(filename))
48 file_list = os.listdir(path)
49 # Normalize the unicode strings, as round-tripping the name via the OS
50 # may return a different (but equivalent) value.
51 base = unicodedata.normalize("NFD", base)
52 file_list = [unicodedata.normalize("NFD", f) for f in file_list]
53
54 self.assertIn(base, file_list)
55
56 # Tests that copy, move, etc one file to another.
57 def _do_copyish(self, filename1, filename2):

Callers 1

_test_singleMethod · 0.95

Calls 15

_do_copyishMethod · 0.95
assertTrueMethod · 0.80
accessMethod · 0.80
utimeMethod · 0.80
escapeMethod · 0.80
listdirMethod · 0.80
assertInMethod · 0.80
existsMethod · 0.45
isfileMethod · 0.45
abspathMethod · 0.45
chmodMethod · 0.45
timeMethod · 0.45

Tested by

no test coverage detected