Skip to content

Commit 358cdc8

Browse files
committed
Fix test deprecation warning on Python 3.11
Python 3.11 warns: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method Test_c3_ro.test_complex_diamond of <zope.interface.tests.test_ro.Test_c3_ro testMethod=test_complex_diamond>>) Rearrange slightly to avoid this.
1 parent 0ce6331 commit 358cdc8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
5.5.3 (unreleased)
66
==================
77

8+
- Fix test deprecation warning on Python 3.11.
9+
810

911
5.5.2 (2022-11-17)
1012
==================

src/zope/interface/tests/test_ro.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _callFUT(self, ob, **kwargs):
202202
from zope.interface.ro import ro
203203
return ro(ob, **kwargs)
204204

205-
def test_complex_diamond(self, base=object):
205+
def _make_complex_diamond(self, base):
206206
# https://github.com/zopefoundation/zope.interface/issues/21
207207
O = base
208208
class F(O):
@@ -223,10 +223,13 @@ class A(B, C):
223223

224224
return A
225225

226+
def test_complex_diamond_object(self):
227+
self._make_complex_diamond(object)
228+
226229
def test_complex_diamond_interface(self):
227230
from zope.interface import Interface
228231

229-
IA = self.test_complex_diamond(Interface)
232+
IA = self._make_complex_diamond(Interface)
230233

231234
self.assertEqual(
232235
[x.__name__ for x in IA.__iro__],
@@ -236,7 +239,7 @@ def test_complex_diamond_interface(self):
236239
def test_complex_diamond_use_legacy_argument(self):
237240
from zope.interface import Interface
238241

239-
A = self.test_complex_diamond(Interface)
242+
A = self._make_complex_diamond(Interface)
240243
legacy_A_iro = self._callFUT(A, use_legacy_ro=True)
241244
self.assertNotEqual(A.__iro__, legacy_A_iro)
242245

@@ -246,7 +249,7 @@ def test_complex_diamond_use_legacy_argument(self):
246249
def test_complex_diamond_compare_legacy_argument(self):
247250
from zope.interface import Interface
248251

249-
A = self.test_complex_diamond(Interface)
252+
A = self._make_complex_diamond(Interface)
250253
computed_A_iro = self._callFUT(A, log_changed_ro=True)
251254
# It matches, of course, but we did log a warning.
252255
self.assertEqual(tuple(computed_A_iro), A.__iro__)

0 commit comments

Comments
 (0)