Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee105dc

Browse files
Fixed test_tempfilepager in test_pydoc on Windows.
Filename such as r'c:\users\db3l\appdata\local\temp\tmph3vkvf' contains '\t' which is interpreted by ast.literal_eval() as a tabulation.
1 parent 664ebb0 commit ee105dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_pydoc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,9 @@ def test_tempfilepager(self):
473473

474474
output = {}
475475
def mock_system(cmd):
476-
import ast
477-
output['content'] = open(ast.literal_eval(cmd.strip())).read()
476+
filename = cmd.strip()[1:-1]
477+
self.assertEqual('"' + filename + '"', cmd.strip())
478+
output['content'] = open(filename).read()
478479
saved, os.system = os.system, mock_system
479480
try:
480481
pydoc.tempfilepager(doc, '')

0 commit comments

Comments
 (0)