Commit 124cc4b3 authored by Matti Picus's avatar Matti Picus
Browse files

fix tests for no c_functools

--HG--
branch : release-pypy3.9-v7.x
parent 779dbcf66803
Pipeline #59199 passed with stage
in 9 minutes and 17 seconds
......@@ -199,7 +199,9 @@ class TestPartial:
kwargs = {'a': object(), 'b': object()}
kwargs_reprs = ['a={a!r}, b={b!r}'.format_map(kwargs),
'b={b!r}, a={a!r}'.format_map(kwargs)]
if self.partial in (c_functools.partial, py_functools.partial):
if c_functools and self.partial is c_functools.partial:
name = 'functools.partial'
elif self.partial is py_functools.partial:
name = 'functools.partial'
else:
name = self.partial.__name__
......@@ -221,7 +223,9 @@ class TestPartial:
for kwargs_repr in kwargs_reprs])
def test_recursive_repr(self):
if self.partial in (c_functools.partial, py_functools.partial):
if c_functools and self.partial is c_functools.partial:
name = 'functools.partial'
elif self.partial is py_functools.partial:
name = 'functools.partial'
else:
name = self.partial.__name__
......@@ -1753,9 +1757,10 @@ class TestLRU:
def py_cached_func(x, y):
return 3 * x + y
@c_functools.lru_cache()
def c_cached_func(x, y):
return 3 * x + y
if c_functools:
@c_functools.lru_cache()
def c_cached_func(x, y):
return 3 * x + y
class TestLRUPy(TestLRU, unittest.TestCase):
......@@ -1772,18 +1777,20 @@ class TestLRUPy(TestLRU, unittest.TestCase):
return 3 * x + y
class TestLRUC(TestLRU, unittest.TestCase):
module = c_functools
cached_func = c_cached_func,
if c_functools:
@unittest.skipUnless(c_functools, 'requires the C _functools module')
class TestLRUC(TestLRU, unittest.TestCase):
module = c_functools
cached_func = c_cached_func,
@module.lru_cache()
def cached_meth(self, x, y):
return 3 * x + y
@module.lru_cache()
def cached_meth(self, x, y):
return 3 * x + y
@staticmethod
@module.lru_cache()
def cached_staticmeth(x, y):
return 3 * x + y
@staticmethod
@module.lru_cache()
def cached_staticmeth(x, y):
return 3 * x + y
class TestSingleDispatch(unittest.TestCase):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment