Skip to content

Commit

Permalink
gh-105751: Remove obsolete object base class in some ctypes tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Jul 31, 2023
1 parent f57b9fd commit 520efec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Lib/test/test_ctypes/test_as_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class S8I(Structure):
(9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))

def test_recursive_as_param(self):
class A(object):
class A:
pass

a = A()
Expand All @@ -201,15 +201,15 @@ class A(object):
c_int.from_param(a)


class AsParamWrapper(object):
class AsParamWrapper:
def __init__(self, param):
self._as_parameter_ = param

class AsParamWrapperTestCase(BasicWrapTestCase):
wrap = AsParamWrapper


class AsParamPropertyWrapper(object):
class AsParamPropertyWrapper:
def __init__(self, param):
self._param = param

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ctypes/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_unsupported_restype_2(self):
def test_issue_7959(self):
proto = self.functype.__func__(None)

class X(object):
class X:
def func(self): pass
def __init__(self):
self.v = proto(self.func)
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_ctypes/test_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_byref(self):
def test_floats(self):
# c_float and c_double can be created from
# Python int and float
class FloatLike(object):
class FloatLike:
def __float__(self):
return 2.0
f = FloatLike()
Expand All @@ -97,15 +97,15 @@ def __float__(self):
self.assertEqual(t(f).value, 2.0)

def test_integers(self):
class FloatLike(object):
class FloatLike:
def __float__(self):
return 2.0
f = FloatLike()
class IntLike(object):
class IntLike:
def __int__(self):
return 2
d = IntLike()
class IndexLike(object):
class IndexLike:
def __index__(self):
return 2
i = IndexLike()
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_ctypes/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def test_noctypes_argtype(self):
# TypeError: has no from_param method
self.assertRaises(TypeError, setattr, func, "argtypes", (object,))

class Adapter(object):
class Adapter:
def from_param(cls, obj):
return None

func.argtypes = (Adapter(),)
self.assertEqual(func(None), None)
self.assertEqual(func(object()), None)

class Adapter(object):
class Adapter:
def from_param(cls, obj):
return obj

Expand All @@ -174,7 +174,7 @@ def from_param(cls, obj):
self.assertRaises(ArgumentError, func, object())
self.assertEqual(func(c_void_p(42)), 42)

class Adapter(object):
class Adapter:
def from_param(cls, obj):
raise ValueError(obj)

Expand Down

0 comments on commit 520efec

Please sign in to comment.