Fixed error handling branches. Thanks

Victor Stinner for pointing this out.
This commit is contained in:
Alexander Belopolsky 2011-01-08 01:23:02 +00:00
parent b8bb4664fc
commit 0dd06f4082
2 changed files with 31 additions and 15 deletions

View file

@ -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__":