mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Fixed error handling branches. Thanks
Victor Stinner for pointing this out.
This commit is contained in:
parent
b8bb4664fc
commit
0dd06f4082
2 changed files with 31 additions and 15 deletions
|
@ -308,13 +308,24 @@ class TestDontAccept2Year(TestAccept2Year):
|
|||
def test_invalid(self):
|
||||
pass
|
||||
|
||||
class TestAccept2YearBad(TestAccept2Year):
|
||||
class X:
|
||||
def __bool__(self):
|
||||
raise RuntimeError('boo')
|
||||
accept2dyear = X()
|
||||
def test_2dyear(self):
|
||||
pass
|
||||
def test_invalid(self):
|
||||
self.assertRaises(RuntimeError, self.yearstr, 200)
|
||||
|
||||
|
||||
class TestDontAccept2YearBool(TestDontAccept2Year):
|
||||
accept2dyear = False
|
||||
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(TimeTestCase, TestLocale,
|
||||
TestAccept2Year, TestAccept2YearBool,
|
||||
TestAccept2Year, TestAccept2YearBool, TestAccept2YearBad,
|
||||
TestDontAccept2Year, TestDontAccept2YearBool)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue