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

Method test_pathlike_file_inplace

Lib/test/test_fileinput.py:489–496  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

487 self.assertEqual(fi.filename(), os.fspath(t1))
488
489 def test_pathlike_file_inplace(self):
490 t1 = FakePath(self.writeTmp('Path-like file.'))
491 with FileInput(t1, inplace=True, encoding="utf-8") as fi:
492 line = fi.readline()
493 self.assertEqual(line, 'Path-like file.')
494 print('Modified %s' % line)
495 with open(t1, encoding="utf-8") as f:
496 self.assertEqual(f.read(), 'Modified Path-like file.\n')
497
498
499class MockFileInput:

Callers

nothing calls this directly

Calls 7

FakePathClass · 0.90
FileInputClass · 0.90
writeTmpMethod · 0.80
openFunction · 0.50
readlineMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected