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

Skip to content

Commit e3874ed

Browse files
author
Victor Stinner
committed
test_cmd_line_script: format paths with ascii() instead of repr()
Fix the test if the native filesystem encoding is not utf-8 (eg. cp1250 on Windows).
1 parent ca9f128 commit e3874ed

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/test/test_cmd_line_script.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ def f():
3030
assertEqual(result, ['Top level assignment', 'Lower level reference'])
3131
# Check population of magic variables
3232
assertEqual(__name__, '__main__')
33-
print('__file__==%r' % __file__)
33+
print('__file__==%a' % __file__)
3434
assertEqual(__cached__, None)
3535
print('__package__==%r' % __package__)
3636
# Check the sys module
3737
import sys
3838
assertIdentical(globals(), sys.modules[__name__].__dict__)
39-
print('sys.argv[0]==%r' % sys.argv[0])
40-
print('sys.path[0]==%r' % sys.path[0])
39+
print('sys.argv[0]==%a' % sys.argv[0])
40+
print('sys.path[0]==%a' % sys.path[0])
4141
# Check the working directory
4242
import os
43-
print('cwd==%r' % os.getcwd())
43+
print('cwd==%a' % os.getcwd())
4444
"""
4545

4646
def _make_test_script(script_dir, script_basename, source=test_source):
@@ -77,11 +77,11 @@ def _check_output(self, script_name, exit_code, data,
7777
print("Output from test script %r:" % script_name)
7878
print(data)
7979
self.assertEqual(exit_code, 0)
80-
printed_file = '__file__==%r' % expected_file
80+
printed_file = '__file__==%a' % expected_file
8181
printed_package = '__package__==%r' % expected_package
82-
printed_argv0 = 'sys.argv[0]==%r' % expected_argv0
83-
printed_path0 = 'sys.path[0]==%r' % expected_path0
84-
printed_cwd = 'cwd==%r' % os.getcwd()
82+
printed_argv0 = 'sys.argv[0]==%a' % expected_argv0
83+
printed_path0 = 'sys.path[0]==%a' % expected_path0
84+
printed_cwd = 'cwd==%a' % os.getcwd()
8585
if verbose > 1:
8686
print('Expected output:')
8787
print(printed_file)

0 commit comments

Comments
 (0)