Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f5a7037

Browse filesBrowse files
authored
gh-93096: fix test_mimetypes.test_invocation_error tests on iOS ARM64 (#132266)
1 parent 0e4cf9c commit f5a7037
Copy full SHA for f5a7037

File tree

2 files changed

+5
-6
lines changed
Filter options

2 files changed

+5
-6
lines changed

‎Lib/mimetypes.py

Copy file name to clipboardExpand all lines: Lib/mimetypes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def _main(args=None):
706706
if guess:
707707
return f"type: {guess} encoding: {encoding}"
708708
sys.exit(f"error: media type unknown for {gtype}")
709-
return parser.format_help()
709+
return help_text
710710

711711

712712
if __name__ == '__main__':

‎Lib/test/test_mimetypes.py

Copy file name to clipboardExpand all lines: Lib/test/test_mimetypes.py
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ def test_parse_args(self):
417417
self.assertFalse(args.lenient)
418418
self.assertEqual(args.type, ["foo.pic"])
419419

420-
421420
def test_invocation(self):
422421
for command, expected in [
423422
("-l -e image/jpg", ".jpg"),
@@ -426,14 +425,14 @@ def test_invocation(self):
426425
]:
427426
self.assertEqual(mimetypes._main(shlex.split(command)), expected)
428427

429-
430428
def test_invocation_error(self):
431429
for command, expected in [
432430
("-e image/jpg", "error: unknown type image/jpg"),
433-
("foo.pic", "error: media type unknown for foo.pic"),
431+
("foo.bar_ext", "error: media type unknown for foo.bar_ext"),
434432
]:
435-
with self.assertRaisesRegex(SystemExit, expected):
436-
mimetypes._main(shlex.split(command))
433+
with self.subTest(command=command):
434+
with self.assertRaisesRegex(SystemExit, expected):
435+
mimetypes._main(shlex.split(command))
437436

438437

439438
if __name__ == "__main__":

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.