diff options
Diffstat (limited to 'Lib/test/test_structmembers.py')
-rw-r--r-- | Lib/test/test_structmembers.py | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/Lib/test/test_structmembers.py b/Lib/test/test_structmembers.py index 0713b87..599c6fb 100644 --- a/Lib/test/test_structmembers.py +++ b/Lib/test/test_structmembers.py @@ -4,7 +4,7 @@ from _testcapi import test_structmembersType, \ INT_MAX, INT_MIN, UINT_MAX, \ LONG_MAX, LONG_MIN, ULONG_MAX -import warnings, unittest, test.test_warnings +import warnings, unittest from test import test_support ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010) @@ -39,34 +39,39 @@ class ReadWriteTests(unittest.TestCase): ts.T_ULONG=ULONG_MAX self.assertEquals(ts.T_ULONG, ULONG_MAX) -class TestWarnings(test.test_warnings.TestModule): - def has_warned(self): - self.assertEqual(test.test_warnings.msg.category, - RuntimeWarning.__name__) +class TestWarnings(unittest.TestCase): + def has_warned(self, w): + self.assert_(w.category is RuntimeWarning) def test_byte_max(self): - ts.T_BYTE=CHAR_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_BYTE=CHAR_MAX+1 + self.has_warned(w) def test_byte_min(self): - ts.T_BYTE=CHAR_MIN-1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_BYTE=CHAR_MIN-1 + self.has_warned(w) def test_ubyte_max(self): - ts.T_UBYTE=UCHAR_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_UBYTE=UCHAR_MAX+1 + self.has_warned(w) def test_short_max(self): - ts.T_SHORT=SHRT_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_SHORT=SHRT_MAX+1 + self.has_warned(w) def test_short_min(self): - ts.T_SHORT=SHRT_MIN-1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_SHORT=SHRT_MIN-1 + self.has_warned(w) def test_ushort_max(self): - ts.T_USHORT=USHRT_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_USHORT=USHRT_MAX+1 + self.has_warned(w) |