Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit5e7f10b

Browse files
committed
Fix test case and add explanation in comment
1 parenta879a9f commit5e7f10b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎Lib/test/test_sys.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,16 @@ def outer():
244244
self.assertIsInstance(sys.exception(),ValueError)
245245
self.assertIsInstance(sys.exception().__context__,TypeError)
246246
yieldnext(g)
247+
# at this point the TypeError from the caller has been handled
248+
# by the caller's except block. Even still, it should still by
249+
# referenced as the __context__ of the current exception.
247250
self.assertIsInstance(sys.exception(),ValueError)
248-
self.assertIsInstance(sys.exception(),TypeError)
251+
self.assertIsInstance(sys.exception().__context__,TypeError)
252+
# not handling an exception, caller isn't anymore either
253+
self.assertIsNone(sys.exception())
254+
withself.assertRaises(StopIteration):
255+
next(g)
256+
self.assertIsNone(sys.exception())
249257

250258
g=outer()
251259
next(g)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp