8000 gh-85308: Add argparse tests for reading non-ASCII arguments from file by serhiy-storchaka · Pull Request #94160 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-85308: Add argparse tests for reading non-ASCII arguments from file #94160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests on Windows.
  • Loading branch information
serhiy-storchaka committed Jun 23, 2022
commit 2e2250aa3f70c52fcd705ed6fb2b1b1eca5ca9ad
8 changes: 5 additions & 3 deletions Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ class TestArgumentsFromFile(TempDirMixin, ParserTestCase):
def setUp(self):
super(TestArgumentsFromFile, self).setUp()
file_texts = [
('hello', os.fsencode(self.hello) + b'\n'),
('hello', self.hello.encode(sys.getfilesystemencoding()) + b'\n'),
('recursive', b'-a\n'
b'A\n'
b'@hello'),
Expand Down Expand Up @@ -1535,9 +1535,11 @@ def setUp(self):
]
if os_helper.TESTFN_UNDECODABLE:
undecodable = os_helper.TESTFN_UNDECODABLE.lstrip(b'@')
decoded_undecodable = undecodable.decode(sys.getfilesystemencoding(),
sys.getfilesystemencodeerrors())
successes += [
('@undecodable X', NS(a=None, x=os.fsdecode(undecodable), y=['X'])),
('X @undecodable', NS(a=None, x='X', y=[os.fsdecode(undecodable)])),
('@undecodable X', NS(a=None, x=decoded_undecodable, y=['X'])),
('X @undecodable', NS(a=None, x='X', y=[decoded_undecodable])),
]
else:
undecodable = b''
Expand Down
0