summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fileinput.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_fileinput.py')
-rw-r--r--Lib/test/test_fileinput.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index b3ad41d..b340ef7 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -23,10 +23,9 @@ except ImportError:
from io import BytesIO, StringIO
from fileinput import FileInput, hook_encoded
-from pathlib import Path
from test.support import verbose
-from test.support.os_helper import TESTFN
+from test.support.os_helper import TESTFN, FakePath
from test.support.os_helper import unlink as safe_unlink
from test.support import os_helper
from test import support
@@ -478,23 +477,23 @@ class FileInputTests(BaseTests, unittest.TestCase):
self.assertRaises(StopIteration, next, fi)
self.assertEqual(src.linesread, [])
- def test_pathlib_file(self):
- t1 = Path(self.writeTmp("Pathlib file."))
+ def test_pathlike_file(self):
+ t1 = FakePath(self.writeTmp("Path-like file."))
with FileInput(t1, encoding="utf-8") as fi:
line = fi.readline()
- self.assertEqual(line, 'Pathlib file.')
+ self.assertEqual(line, 'Path-like file.')
self.assertEqual(fi.lineno(), 1)
self.assertEqual(fi.filelineno(), 1)
self.assertEqual(fi.filename(), os.fspath(t1))
- def test_pathlib_file_inplace(self):
- t1 = Path(self.writeTmp('Pathlib file.'))
+ def test_pathlike_file_inplace(self):
+ t1 = FakePath(self.writeTmp('Path-like file.'))
with FileInput(t1, inplace=True, encoding="utf-8") as fi:
line = fi.readline()
- self.assertEqual(line, 'Pathlib file.')
+ self.assertEqual(line, 'Path-like file.')
print('Modified %s' % line)
with open(t1, encoding="utf-8") as f:
- self.assertEqual(f.read(), 'Modified Pathlib file.\n')
+ self.assertEqual(f.read(), 'Modified Path-like file.\n')
class MockFileInput: