mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-45878: convert try/except
to self.assertRaises
in Lib/ctypes/test/test_functions.py
(GH-29721)
This commit is contained in:
parent
2c047f604e
commit
b48ac6fe38
2 changed files with 6 additions and 14 deletions
|
@ -35,34 +35,24 @@ class FunctionTestCase(unittest.TestCase):
|
|||
# wasn't checked, and it even crashed Python.
|
||||
# Found by Greg Chapman.
|
||||
|
||||
try:
|
||||
with self.assertRaises(TypeError):
|
||||
class X(object, Array):
|
||||
_length_ = 5
|
||||
_type_ = "i"
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
from _ctypes import _Pointer
|
||||
try:
|
||||
with self.assertRaises(TypeError):
|
||||
class X(object, _Pointer):
|
||||
pass
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
from _ctypes import _SimpleCData
|
||||
try:
|
||||
with self.assertRaises(TypeError):
|
||||
class X(object, _SimpleCData):
|
||||
_type_ = "i"
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
with self.assertRaises(TypeError):
|
||||
class X(object, Structure):
|
||||
_fields_ = []
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
@need_symbol('c_wchar')
|
||||
def test_wchar_parm(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue