diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-10-25 09:36:47 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-10-25 09:45:24 +0300 |
commit | 6eda6c243d60466bdad66b46cdcbd6293fb4424f (patch) | |
tree | 9fcb61ca9b66425b3cd473aa5301e9733259a37b | |
parent | 71cfb7652c50b626f60cf145b918e4e91acc86d0 (diff) | |
download | ydb-6eda6c243d60466bdad66b46cdcbd6293fb4424f.tar.gz |
Intermediate changes
commit_hash:7a203c6d0c248df6f8cf32d7de94727084be033c
14 files changed, 554 insertions, 444 deletions
diff --git a/contrib/python/zope.interface/py3/.dist-info/METADATA b/contrib/python/zope.interface/py3/.dist-info/METADATA index 369d5d2401..30f01bb893 100644 --- a/contrib/python/zope.interface/py3/.dist-info/METADATA +++ b/contrib/python/zope.interface/py3/.dist-info/METADATA @@ -1,10 +1,10 @@ Metadata-Version: 2.1 Name: zope.interface -Version: 7.0.3 +Version: 7.1.0 Summary: Interfaces for Python Home-page: https://github.com/zopefoundation/zope.interface Author: Zope Foundation and Contributors -Author-email: zope-dev@zope.org +Author-email: zope-dev@zope.dev License: ZPL 2.1 Keywords: interface,components,plugins Classifier: Development Status :: 5 - Production/Stable @@ -18,25 +18,27 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope :: 3 Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=3.8 +Description-Content-Type: text/x-rst License-File: LICENSE.txt Requires-Dist: setuptools Provides-Extra: docs -Requires-Dist: Sphinx; extra == "docs" -Requires-Dist: repoze.sphinx.autointerface; extra == "docs" -Requires-Dist: sphinx-rtd-theme; extra == "docs" +Requires-Dist: Sphinx ; extra == 'docs' +Requires-Dist: repoze.sphinx.autointerface ; extra == 'docs' +Requires-Dist: furo ; extra == 'docs' Provides-Extra: test -Requires-Dist: coverage>=5.0.3; extra == "test" -Requires-Dist: zope.event; extra == "test" -Requires-Dist: zope.testing; extra == "test" +Requires-Dist: coverage[toml] ; extra == 'test' +Requires-Dist: zope.event ; extra == 'test' +Requires-Dist: zope.testing ; extra == 'test' Provides-Extra: testing -Requires-Dist: coverage>=5.0.3; extra == "testing" -Requires-Dist: zope.event; extra == "testing" -Requires-Dist: zope.testing; extra == "testing" +Requires-Dist: coverage[toml] ; extra == 'testing' +Requires-Dist: zope.event ; extra == 'testing' +Requires-Dist: zope.testing ; extra == 'testing' ==================== ``zope.interface`` @@ -74,6 +76,15 @@ For detailed documentation, please see https://zopeinterface.readthedocs.io/en/l Changes ========= +7.1.0 (2024-10-10) +================== + +- Declare support for Python 3.13. + +- Fix segmentation faults on Python 3.13. + (`#323 <https://github.com/zopefoundation/zope.interface/issues/323>`_) + + 7.0.3 (2024-08-27) ================== diff --git a/contrib/python/zope.interface/py3/ya.make b/contrib/python/zope.interface/py3/ya.make index 966c73c1fe..2448b66894 100644 --- a/contrib/python/zope.interface/py3/ya.make +++ b/contrib/python/zope.interface/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(7.0.3) +VERSION(7.1.0) LICENSE(ZPL-2.1) diff --git a/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py b/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py index 74386de024..9075795822 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py @@ -19,6 +19,8 @@ from zope.interface import classImplements class IException(Interface): "Interface for `Exception`" + + classImplements(Exception, IException) # noqa E305 @@ -28,116 +30,162 @@ class IStandardError(IException): class IWarning(IException): "Interface for `Warning`" + + classImplements(Warning, IWarning) # noqa E305 class ISyntaxError(IStandardError): "Interface for `SyntaxError`" + + classImplements(SyntaxError, ISyntaxError) # noqa E305 class ILookupError(IStandardError): "Interface for `LookupError`" + + classImplements(LookupError, ILookupError) # noqa E305 class IValueError(IStandardError): "Interface for `ValueError`" + + classImplements(ValueError, IValueError) # noqa E305 class IRuntimeError(IStandardError): "Interface for `RuntimeError`" + + classImplements(RuntimeError, IRuntimeError) # noqa E305 class IArithmeticError(IStandardError): "Interface for `ArithmeticError`" + + classImplements(ArithmeticError, IArithmeticError) # noqa E305 class IAssertionError(IStandardError): "Interface for `AssertionError`" + + classImplements(AssertionError, IAssertionError) # noqa E305 class IAttributeError(IStandardError): "Interface for `AttributeError`" + + classImplements(AttributeError, IAttributeError) # noqa E305 class IDeprecationWarning(IWarning): "Interface for `DeprecationWarning`" + + classImplements(DeprecationWarning, IDeprecationWarning) # noqa E305 class IEOFError(IStandardError): "Interface for `EOFError`" + + classImplements(EOFError, IEOFError) # noqa E305 class IEnvironmentError(IStandardError): "Interface for `EnvironmentError`" + + classImplements(EnvironmentError, IEnvironmentError) # noqa E305 class IFloatingPointError(IArithmeticError): "Interface for `FloatingPointError`" + + classImplements(FloatingPointError, IFloatingPointError) # noqa E305 class IIOError(IEnvironmentError): "Interface for `IOError`" + + classImplements(IOError, IIOError) # noqa E305 class IImportError(IStandardError): "Interface for `ImportError`" + + classImplements(ImportError, IImportError) # noqa E305 class IIndentationError(ISyntaxError): "Interface for `IndentationError`" + + classImplements(IndentationError, IIndentationError) # noqa E305 class IIndexError(ILookupError): "Interface for `IndexError`" + + classImplements(IndexError, IIndexError) # noqa E305 class IKeyError(ILookupError): "Interface for `KeyError`" + + classImplements(KeyError, IKeyError) # noqa E305 class IKeyboardInterrupt(IStandardError): "Interface for `KeyboardInterrupt`" + + classImplements(KeyboardInterrupt, IKeyboardInterrupt) # noqa E305 class IMemoryError(IStandardError): "Interface for `MemoryError`" + + classImplements(MemoryError, IMemoryError) # noqa E305 class INameError(IStandardError): "Interface for `NameError`" + + classImplements(NameError, INameError) # noqa E305 class INotImplementedError(IRuntimeError): "Interface for `NotImplementedError`" + + classImplements(NotImplementedError, INotImplementedError) # noqa E305 class IOSError(IEnvironmentError): "Interface for `OSError`" + + classImplements(OSError, IOSError) # noqa E305 class IOverflowError(IArithmeticError): "Interface for `ArithmeticError`" + + classImplements(OverflowError, IOverflowError) # noqa E305 @@ -151,59 +199,83 @@ class IOverflowWarning(IWarning): class IReferenceError(IStandardError): "Interface for `ReferenceError`" + + classImplements(ReferenceError, IReferenceError) # noqa E305 class IRuntimeWarning(IWarning): "Interface for `RuntimeWarning`" + + classImplements(RuntimeWarning, IRuntimeWarning) # noqa E305 class IStopIteration(IException): "Interface for `StopIteration`" + + classImplements(StopIteration, IStopIteration) # noqa E305 class ISyntaxWarning(IWarning): "Interface for `SyntaxWarning`" + + classImplements(SyntaxWarning, ISyntaxWarning) # noqa E305 class ISystemError(IStandardError): "Interface for `SystemError`" + + classImplements(SystemError, ISystemError) # noqa E305 class ISystemExit(IException): "Interface for `SystemExit`" + + classImplements(SystemExit, ISystemExit) # noqa E305 class ITabError(IIndentationError): "Interface for `TabError`" + + classImplements(TabError, ITabError) # noqa E305 class ITypeError(IStandardError): "Interface for `TypeError`" + + classImplements(TypeError, ITypeError) # noqa E305 class IUnboundLocalError(INameError): "Interface for `UnboundLocalError`" + + classImplements(UnboundLocalError, IUnboundLocalError) # noqa E305 class IUnicodeError(IValueError): "Interface for `UnicodeError`" + + classImplements(UnicodeError, IUnicodeError) # noqa E305 class IUserWarning(IWarning): "Interface for `UserWarning`" + + classImplements(UserWarning, IUserWarning) # noqa E305 class IZeroDivisionError(IArithmeticError): "Interface for `ZeroDivisionError`" + + classImplements(ZeroDivisionError, IZeroDivisionError) # noqa E305 diff --git a/contrib/python/zope.interface/py3/zope/interface/common/tests/basemapping.py b/contrib/python/zope.interface/py3/zope/interface/common/tests/basemapping.py index db4c091ff6..fc4e285057 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/tests/basemapping.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/tests/basemapping.py @@ -20,7 +20,7 @@ def _testIReadMapping(self, inst, state, absent): for key in state: self.assertEqual(inst[key], state[key]) self.assertEqual(inst.get(key, None), state[key]) - self.assertTrue(key in inst) + self.assertIn(key, inst) for key in absent: self.assertEqual(inst.get(key, None), None) diff --git a/contrib/python/zope.interface/py3/zope/interface/common/tests/test_collections.py b/contrib/python/zope.interface/py3/zope/interface/common/tests/test_collections.py index 6d23f6f960..df7dec99a2 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/tests/test_collections.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/tests/test_collections.py @@ -12,6 +12,7 @@ import array +import sys import unittest from collections import OrderedDict from collections import abc @@ -100,6 +101,10 @@ class TestVerifyClass(VerifyClassMixin, unittest.TestCase): add_abc_interface_tests(TestVerifyClass, collections.ISet.__module__) +def _get_FrameLocalsProxy(): + return type(sys._getframe().f_locals) + + class TestVerifyObject(VerifyObjectMixin, TestVerifyClass): CONSTRUCTORS = { @@ -127,6 +132,11 @@ class TestVerifyObject(VerifyObjectMixin, 'async_generator': unittest.SkipTest, type(iter(tuple())): lambda: iter(tuple()), } + if sys.version_info >= (3, 13): + def FrameLocalsProxy_constructor(): + return _get_FrameLocalsProxy()(sys._getframe()) + FrameLocalsProxy = _get_FrameLocalsProxy() + CONSTRUCTORS[FrameLocalsProxy] = FrameLocalsProxy_constructor UNVERIFIABLE_RO = { # ``array.array`` fails the ``test_auto_ro_*`` tests with and diff --git a/contrib/python/zope.interface/py3/zope/interface/declarations.py b/contrib/python/zope.interface/py3/zope/interface/declarations.py index a9b983da81..825c578920 100644 --- a/contrib/python/zope.interface/py3/zope/interface/declarations.py +++ b/contrib/python/zope.interface/py3/zope/interface/declarations.py @@ -953,6 +953,7 @@ class ClassProvides(Declaration, ClassProvidesBase): __get__ = ClassProvidesBase.__get__ +# autopep8: off (it breaks the statements in the "if") def directlyProvidedBy(object): # pylint:disable=redefined-builtin """Return the interfaces directly provided by the given object @@ -970,6 +971,7 @@ def directlyProvidedBy(object): # pylint:disable=redefined-builtin # Strip off the class part of the spec: return Declaration(provides.__bases__[:-1]) +# autopep8: on class provider: diff --git a/contrib/python/zope.interface/py3/zope/interface/interface.py b/contrib/python/zope.interface/py3/zope/interface/interface.py index 575b6381e3..e5dddb8811 100644 --- a/contrib/python/zope.interface/py3/zope/interface/interface.py +++ b/contrib/python/zope.interface/py3/zope/interface/interface.py @@ -825,8 +825,8 @@ class InterfaceClass(_InterfaceClassBase): # __firstlineno__: Python 3.13b1+ # https://github.com/python/cpython/pull/118475 '__firstlineno__', - ) - and aval is not _decorator_non_return # noqa W503 + ) and + aval is not _decorator_non_return # noqa W503 } def interfaces(self): diff --git a/contrib/python/zope.interface/py3/zope/interface/interfaces.py b/contrib/python/zope.interface/py3/zope/interface/interfaces.py index 454fee893c..9bafeb5842 100644 --- a/contrib/python/zope.interface/py3/zope/interface/interfaces.py +++ b/contrib/python/zope.interface/py3/zope/interface/interfaces.py @@ -1156,6 +1156,7 @@ class IRegistrationEvent(IObjectEvent): class RegistrationEvent(ObjectEvent): """There has been a change in a registration """ + def __repr__(self): return f"{self.__class__.__name__} event:\n{self.object!r}" diff --git a/contrib/python/zope.interface/py3/zope/interface/tests/test_advice.py b/contrib/python/zope.interface/py3/zope/interface/tests/test_advice.py index 5d5f0218b0..e439b44779 100644 --- a/contrib/python/zope.interface/py3/zope/interface/tests/test_advice.py +++ b/contrib/python/zope.interface/py3/zope/interface/tests/test_advice.py @@ -37,7 +37,7 @@ class FrameInfoTest(unittest.TestCase): f_locals, f_globals) = advisory_testing.moduleLevelFrameInfo self.assertEqual(kind, "module") for d in module.__dict__, f_locals, f_globals: - self.assertTrue(d is advisory_testing.my_globals) + self.assertIs(d, advisory_testing.my_globals) def test_w_class(self): from . import advisory_testing @@ -48,7 +48,7 @@ class FrameInfoTest(unittest.TestCase): self.assertEqual(kind, "class") for d in module.__dict__, f_globals: - self.assertTrue(d is advisory_testing.my_globals) + self.assertIs(d, advisory_testing.my_globals) def test_inside_function_call(self): from zope.interface.advice import getFrameInfo @@ -60,7 +60,7 @@ class FrameInfoTest(unittest.TestCase): self.assertEqual(f_locals, locals()) for d in module.__dict__, f_globals: - self.assertTrue(d is globals()) + self.assertIs(d, globals()) def test_inside_exec(self): from zope.interface.advice import getFrameInfo @@ -68,9 +68,9 @@ class FrameInfoTest(unittest.TestCase): _locals = {} exec(_FUNKY_EXEC, _globals, _locals) self.assertEqual(_locals['kind'], "exec") - self.assertTrue(_locals['f_locals'] is _locals) - self.assertTrue(_locals['module'] is None) - self.assertTrue(_locals['f_globals'] is _globals) + self.assertIs(_locals['f_locals'], _locals) + self.assertIsNone(_locals['module']) + self.assertIs(_locals['f_globals'], _globals) _FUNKY_EXEC = """\ diff --git a/contrib/python/zope.interface/py3/zope/interface/tests/test_declarations.py b/contrib/python/zope.interface/py3/zope/interface/tests/test_declarations.py index 6b76d8eaf8..64fc0e0696 100644 --- a/contrib/python/zope.interface/py3/zope/interface/tests/test_declarations.py +++ b/contrib/python/zope.interface/py3/zope/interface/tests/test_declarations.py @@ -457,15 +457,16 @@ class TestImplements(NameAndModuleComparisonTestsMixin, self.assertEqual(implementedBy(A), implementedBy(A)) self.assertEqual(hash(implementedBy(A)), hash(implementedBy(A))) - self.assertTrue(implementedBy(A) < None) - self.assertTrue( - None > implementedBy(A) - ) # pylint:disable=misplaced-comparison-constant - self.assertTrue(implementedBy(A) < implementedBy(B)) - self.assertTrue(implementedBy(A) > IFoo) - self.assertTrue(implementedBy(A) <= implementedBy(B)) - self.assertTrue(implementedBy(A) >= IFoo) - self.assertTrue(implementedBy(A) != IFoo) + self.assertLess(implementedBy(A), None) + self.assertGreater( + None, + implementedBy(A) + ) + self.assertLess(implementedBy(A), implementedBy(B)) + self.assertGreater(implementedBy(A), IFoo) + self.assertLessEqual(implementedBy(A), implementedBy(B)) + self.assertGreaterEqual(implementedBy(A), IFoo) + self.assertNotEqual(implementedBy(A), IFoo) def test_proxy_equality(self): # https://github.com/zopefoundation/zope.interface/issues/55 @@ -496,19 +497,20 @@ class TestImplements(NameAndModuleComparisonTestsMixin, # The order of arguments to the operators matters, # test both - self.assertTrue( - implementedByA == implementedByA - ) # pylint:disable=comparison-with-itself - self.assertTrue(implementedByA != implementedByB) - self.assertTrue(implementedByB != implementedByA) + self.assertEqual( + implementedByA, + implementedByA + ) + self.assertNotEqual(implementedByA, implementedByB) + self.assertNotEqual(implementedByB, implementedByA) - self.assertTrue(proxy == implementedByA) - self.assertTrue(implementedByA == proxy) - self.assertFalse(proxy != implementedByA) - self.assertFalse(implementedByA != proxy) + self.assertEqual(proxy, implementedByA) + self.assertEqual(implementedByA, proxy) + self.assertEqual(proxy, implementedByA) + self.assertEqual(implementedByA, proxy) - self.assertTrue(proxy != implementedByB) - self.assertTrue(implementedByB != proxy) + self.assertNotEqual(proxy, implementedByB) + self.assertNotEqual(implementedByB, proxy) def test_changed_deletes_super_cache(self): impl = self._makeOne() @@ -581,7 +583,7 @@ class Test_implementedByFallback(unittest.TestCase): with _MonkeyDict(declarations, 'BuiltinImplementationSpecifications') as specs: specs[foo] = reg - self.assertTrue(self._callFUT(foo) is reg) + self.assertIs(self._callFUT(foo), reg) def test_dictless_w_existing_Implements(self): from zope.interface.declarations import Implements @@ -592,7 +594,7 @@ class Test_implementedByFallback(unittest.TestCase): foo = Foo() foo.__implemented__ = impl - self.assertTrue(self._callFUT(foo) is impl) + self.assertIs(self._callFUT(foo), impl) def test_dictless_w_existing_not_Implements(self): from zope.interface.interface import InterfaceClass @@ -612,7 +614,7 @@ class Test_implementedByFallback(unittest.TestCase): class Foo: __implemented__ = impl - self.assertTrue(self._callFUT(Foo) is impl) + self.assertIs(self._callFUT(Foo), impl) def test_builtins_added_to_cache(self): from zope.interface import declarations @@ -637,9 +639,9 @@ class Test_implementedByFallback(unittest.TestCase): specs[tuple] = t_spec specs[list] = l_spec specs[dict] = d_spec - self.assertTrue(self._callFUT(tuple) is t_spec) - self.assertTrue(self._callFUT(list) is l_spec) - self.assertTrue(self._callFUT(dict) is d_spec) + self.assertIs(self._callFUT(tuple), t_spec) + self.assertIs(self._callFUT(list), l_spec) + self.assertIs(self._callFUT(dict), d_spec) def test_oldstyle_class_no_assertions(self): # TODO: Figure out P3 story @@ -714,7 +716,7 @@ class Test_implementedByFallback(unittest.TestCase): class Foo: __implemented__ = impl - self.assertTrue(self._callFUT(Foo) is impl) + self.assertIs(self._callFUT(Foo), impl) def test_super_when_base_implements_interface(self): from zope.interface import Interface @@ -963,7 +965,7 @@ class Test_classImplementsOnly(_ImplementsTestMixin, unittest.TestCase): impl.inherit = Foo self._callFUT(Foo, IBar) # Same spec, now different values - self.assertTrue(Foo.__implemented__ is impl) + self.assertIs(Foo.__implemented__, impl) self.assertEqual(impl.inherit, None) self.assertEqual(impl.declared, (IBar,)) @@ -1172,7 +1174,7 @@ class Test_implementer(Test_classImplements): foo = Foo() decorator = self._makeOne(IFoo) returned = decorator(foo) - self.assertTrue(returned is foo) + self.assertIs(returned, foo) spec = foo.__implemented__ # pylint:disable=no-member self.assertEqual( spec.__name__, '__tests__.tests.test_declarations.?' @@ -1564,7 +1566,7 @@ class Test_Provides(unittest.TestCase): with _Monkey(declarations, InstanceDeclarations=cache): spec = self._callFUT(Foo, IFoo) self.assertEqual(list(spec), [IFoo]) - self.assertTrue(cache[(Foo, IFoo)] is spec) + self.assertIs(cache[(Foo, IFoo)], spec) def test_w_cached_spec(self): from zope.interface import declarations @@ -1578,7 +1580,7 @@ class Test_Provides(unittest.TestCase): cache = {(Foo, IFoo): prior} with _Monkey(declarations, InstanceDeclarations=cache): spec = self._callFUT(Foo, IFoo) - self.assertTrue(spec is prior) + self.assertIs(spec, prior) class Test_directlyProvides(unittest.TestCase): @@ -1775,7 +1777,7 @@ class ClassProvidesBaseFallbackTests(unittest.TestCase): pass cpbp = Foo.__provides__ = self._makeOne(Foo, IFoo) - self.assertTrue(Foo.__provides__ is cpbp) + self.assertIs(Foo.__provides__, cpbp) def test_w_same_class_via_instance(self): from zope.interface.interface import InterfaceClass @@ -1841,7 +1843,7 @@ class ClassProvidesTests(unittest.TestCase): pass cp = Foo.__provides__ = self._makeOne(Foo, type(Foo), IBar) - self.assertTrue(Foo.__provides__ is cp) + self.assertIs(Foo.__provides__, cp) self.assertEqual(list(Foo().__provides__), [IFoo]) def test___reduce__(self): @@ -2323,7 +2325,7 @@ class Test_providedByFallback(unittest.TestCase): foo.__providedBy__ = object() expected = foo.__provides__ = object() spec = self._callFUT(foo) - self.assertTrue(spec is expected) + self.assertIs(spec, expected) def test_w_providedBy_invalid_spec_w_provides_diff_provides_on_class(self): @@ -2335,7 +2337,7 @@ class Test_providedByFallback(unittest.TestCase): expected = foo.__provides__ = object() Foo.__provides__ = object() spec = self._callFUT(foo) - self.assertTrue(spec is expected) + self.assertIs(spec, expected) def test_w_providedBy_invalid_spec_w_provides_same_provides_on_class(self): from zope.interface.declarations import implementer diff --git a/contrib/python/zope.interface/py3/zope/interface/tests/test_interface.py b/contrib/python/zope.interface/py3/zope/interface/tests/test_interface.py index a07ae9f7ab..b6f59c8331 100644 --- a/contrib/python/zope.interface/py3/zope/interface/tests/test_interface.py +++ b/contrib/python/zope.interface/py3/zope/interface/tests/test_interface.py @@ -505,8 +505,8 @@ class SpecificationTests(unittest.TestCase): spec = self._makeOne() self.assertEqual(spec.__bases__, ()) self.assertEqual(len(spec._implied), 2) - self.assertTrue(spec in spec._implied) - self.assertTrue(Interface in spec._implied) + self.assertIn(spec, spec._implied) + self.assertIn(Interface, spec._implied) self.assertEqual(len(spec.dependents), 0) def test_subscribe_first_time(self): @@ -536,7 +536,7 @@ class SpecificationTests(unittest.TestCase): spec.unsubscribe(dep) self.assertEqual(spec.dependents[dep], 1) spec.unsubscribe(dep) - self.assertFalse(dep in spec.dependents) + self.assertNotIn(dep, spec.dependents) def test___setBases_subscribes_bases_and_notifies_dependents(self): from zope.interface.interface import Interface @@ -568,7 +568,7 @@ class SpecificationTests(unittest.TestCase): spec._implied[IFoo] = () spec.changed(spec) self.assertIsNone(spec._v_attrs) - self.assertFalse(IFoo in spec._implied) + self.assertNotIn(IFoo, spec._implied) def test_interfaces_skips_already_seen(self): from zope.interface.interface import Interface @@ -600,7 +600,7 @@ class SpecificationTests(unittest.TestCase): spec = self._makeOne() foo = object() spec._v_attrs = {'foo': foo} - self.assertTrue(spec.get('foo') is foo) + self.assertIs(spec.get('foo'), foo) def test_get_hit_from_base_wo__v_attrs(self): from zope.interface.interface import Attribute @@ -613,8 +613,8 @@ class SpecificationTests(unittest.TestCase): bar = Attribute('bar') spec = self._makeOne([IFoo, IBar]) - self.assertTrue(spec.get('foo') is IFoo.get('foo')) - self.assertTrue(spec.get('bar') is IBar.get('bar')) + self.assertIs(spec.get('foo'), IFoo.get('foo')) + self.assertIs(spec.get('bar'), IBar.get('bar')) def test_multiple_inheritance_no_interfaces(self): # If we extend an object that implements interfaces, @@ -998,7 +998,7 @@ class InterfaceClassTests(unittest.TestCase): def test___contains___miss(self): one = self._makeOne() - self.assertFalse('nonesuch' in one) + self.assertNotIn('nonesuch', one) def test___contains___hit(self): from zope.interface.interface import Attribute @@ -1012,8 +1012,8 @@ class InterfaceClassTests(unittest.TestCase): 'bar': fromFunction(_bar), } one = self._makeOne(attrs=ATTRS) - self.assertTrue('foo' in one) - self.assertTrue('bar' in one) + self.assertIn('foo', one) + self.assertIn('bar', one) def test_direct_miss(self): one = self._makeOne() @@ -1102,7 +1102,7 @@ class InterfaceClassTests(unittest.TestCase): self.assertRaises(Invalid, iface.validateInvariants, obj, _errors) self.assertEqual(_fail_called_with, [((obj,), {})]) self.assertEqual(len(_errors), 1) - self.assertTrue(isinstance(_errors[0], Invalid)) + self.assertIsInstance(_errors[0], Invalid) def test_validateInvariants_fail_in_base_wo_errors_passed(self): from zope.interface.exceptions import Invalid @@ -1151,7 +1151,7 @@ class InterfaceClassTests(unittest.TestCase): self.assertEqual(_passable_called_with, [((obj,), {})]) self.assertEqual(_fail_called_with, [((obj,), {})]) self.assertEqual(len(_errors), 1) - self.assertTrue(isinstance(_errors[0], Invalid)) + self.assertIsInstance(_errors[0], Invalid) def test_validateInvariants_inherited_not_called_multiple_times(self): _passable_called_with = [] @@ -1191,29 +1191,29 @@ class InterfaceClassTests(unittest.TestCase): def test_comparison_with_None(self): # pylint:disable=singleton-comparison,misplaced-comparison-constant iface = self._makeOne() - self.assertTrue(iface < None) # noqa E711 - self.assertTrue(iface <= None) # noqa E711 - self.assertFalse(iface == None) # noqa E711 - self.assertTrue(iface != None) # noqa E711 + self.assertLess(iface, None) # noqa E711 + self.assertLessEqual(iface, None) # noqa E711 + self.assertNotEqual(iface, None) # noqa E711 + self.assertNotEqual(iface, None) # noqa E711 self.assertFalse(iface >= None) # noqa E711 self.assertFalse(iface > None) # noqa E711 self.assertFalse(None < iface) # noqa E711 self.assertFalse(None <= iface) # noqa E711 - self.assertFalse(None == iface) # noqa E711 - self.assertTrue(None != iface) # noqa E711 - self.assertTrue(None >= iface) # noqa E711 - self.assertTrue(None > iface) # noqa E711 + self.assertNotEqual(None, iface) # noqa E711 + self.assertNotEqual(None, iface) # noqa E711 + self.assertGreaterEqual(None, iface) # noqa E711 + self.assertGreater(None, iface) # noqa E711 def test_comparison_with_same_instance(self): # pylint:disable=comparison-with-itself iface = self._makeOne() self.assertFalse(iface < iface) - self.assertTrue(iface <= iface) - self.assertTrue(iface == iface) - self.assertFalse(iface != iface) - self.assertTrue(iface >= iface) + self.assertLessEqual(iface, iface) + self.assertEqual(iface, iface) + self.assertEqual(iface, iface) + self.assertGreaterEqual(iface, iface) self.assertFalse(iface > iface) def test_comparison_with_same_named_instance_in_other_module(self): @@ -1221,18 +1221,18 @@ class InterfaceClassTests(unittest.TestCase): one = self._makeOne('IName', __module__='__tests__.tests.one') other = self._makeOne('IName', __module__='__tests__.tests.other') - self.assertTrue(one < other) + self.assertLess(one, other) self.assertFalse(other < one) - self.assertTrue(one <= other) + self.assertLessEqual(one, other) self.assertFalse(other <= one) - self.assertFalse(one == other) - self.assertFalse(other == one) - self.assertTrue(one != other) - self.assertTrue(other != one) + self.assertNotEqual(one, other) + self.assertNotEqual(other, one) + self.assertNotEqual(one, other) + self.assertNotEqual(other, one) self.assertFalse(one >= other) - self.assertTrue(other >= one) + self.assertGreaterEqual(other, one) self.assertFalse(one > other) - self.assertTrue(other > one) + self.assertGreater(other, one) def test_assignment_to__class__(self): # https://github.com/zopefoundation/zope.interface/issues/6 @@ -1299,7 +1299,7 @@ class InterfaceTests(unittest.TestCase): class I1(Interface): attr = Attribute("My attr") - self.assertTrue(I1['attr'].interface is I1) + self.assertIs(I1['attr'].interface, I1) def test_methods_link_to_interface(self): from zope.interface import Interface @@ -1308,7 +1308,7 @@ class InterfaceTests(unittest.TestCase): def method(foo, bar, bingo): "A method" - self.assertTrue(I1['method'].interface is I1) + self.assertIs(I1['method'].interface, I1) def test_classImplements_simple(self): from zope.interface import Interface @@ -1339,10 +1339,10 @@ class InterfaceTests(unittest.TestCase): self.assertTrue(ICurrent.implementedBy(Current)) self.assertFalse(IOther.implementedBy(Current)) self.assertEqual(ICurrent, ICurrent) - self.assertTrue(ICurrent in implementedBy(Current)) - self.assertFalse(IOther in implementedBy(Current)) - self.assertTrue(ICurrent in providedBy(current)) - self.assertFalse(IOther in providedBy(current)) + self.assertIn(ICurrent, implementedBy(Current)) + self.assertNotIn(IOther, implementedBy(Current)) + self.assertIn(ICurrent, providedBy(current)) + self.assertNotIn(IOther, providedBy(current)) def test_classImplements_base_not_derived(self): from zope.interface import Interface @@ -1366,10 +1366,10 @@ class InterfaceTests(unittest.TestCase): self.assertTrue(IBase.implementedBy(Current)) self.assertFalse(IDerived.implementedBy(Current)) - self.assertTrue(IBase in implementedBy(Current)) - self.assertFalse(IDerived in implementedBy(Current)) - self.assertTrue(IBase in providedBy(current)) - self.assertFalse(IDerived in providedBy(current)) + self.assertIn(IBase, implementedBy(Current)) + self.assertNotIn(IDerived, implementedBy(Current)) + self.assertIn(IBase, providedBy(current)) + self.assertNotIn(IDerived, providedBy(current)) def test_classImplements_base_and_derived(self): from zope.interface import Interface @@ -1393,12 +1393,12 @@ class InterfaceTests(unittest.TestCase): self.assertTrue(IBase.implementedBy(Current)) self.assertTrue(IDerived.implementedBy(Current)) - self.assertFalse(IBase in implementedBy(Current)) - self.assertTrue(IBase in implementedBy(Current).flattened()) - self.assertTrue(IDerived in implementedBy(Current)) - self.assertFalse(IBase in providedBy(current)) - self.assertTrue(IBase in providedBy(current).flattened()) - self.assertTrue(IDerived in providedBy(current)) + self.assertNotIn(IBase, implementedBy(Current)) + self.assertIn(IBase, implementedBy(Current).flattened()) + self.assertIn(IDerived, implementedBy(Current)) + self.assertNotIn(IBase, providedBy(current)) + self.assertIn(IBase, providedBy(current).flattened()) + self.assertIn(IDerived, providedBy(current)) def test_classImplements_multiple(self): from zope.interface import Interface @@ -1428,10 +1428,10 @@ class InterfaceTests(unittest.TestCase): self.assertTrue(ILeft.implementedBy(Ambi)) self.assertTrue(IRight.implementedBy(Ambi)) - self.assertTrue(ILeft in implementedBy(Ambi)) - self.assertTrue(IRight in implementedBy(Ambi)) - self.assertTrue(ILeft in providedBy(ambi)) - self.assertTrue(IRight in providedBy(ambi)) + self.assertIn(ILeft, implementedBy(Ambi)) + self.assertIn(IRight, implementedBy(Ambi)) + self.assertIn(ILeft, providedBy(ambi)) + self.assertIn(IRight, providedBy(ambi)) def test_classImplements_multiple_w_explict_implements(self): from zope.interface import Interface @@ -1469,12 +1469,12 @@ class InterfaceTests(unittest.TestCase): self.assertTrue(ILeft.implementedBy(Mixed)) self.assertFalse(IRight.implementedBy(Mixed)) self.assertTrue(IOther.implementedBy(Mixed)) - self.assertTrue(ILeft in implementedBy(Mixed)) - self.assertFalse(IRight in implementedBy(Mixed)) - self.assertTrue(IOther in implementedBy(Mixed)) - self.assertTrue(ILeft in providedBy(mixed)) - self.assertFalse(IRight in providedBy(mixed)) - self.assertTrue(IOther in providedBy(mixed)) + self.assertIn(ILeft, implementedBy(Mixed)) + self.assertNotIn(IRight, implementedBy(Mixed)) + self.assertIn(IOther, implementedBy(Mixed)) + self.assertIn(ILeft, providedBy(mixed)) + self.assertNotIn(IRight, providedBy(mixed)) + self.assertIn(IOther, providedBy(mixed)) def testInterfaceExtendsInterface(self): from zope.interface import Interface @@ -1594,11 +1594,11 @@ class InterfaceTests(unittest.TestCase): self.assertEqual(len(name_values), 2) self.assertEqual(name_values[0][0], 'attr') - self.assertTrue(isinstance(name_values[0][1], Attribute)) + self.assertIsInstance(name_values[0][1], Attribute) self.assertEqual(name_values[0][1].__name__, 'attr') self.assertEqual(name_values[0][1].__doc__, 'My attr') self.assertEqual(name_values[1][0], 'method') - self.assertTrue(isinstance(name_values[1][1], Method)) + self.assertIsInstance(name_values[1][1], Method) self.assertEqual(name_values[1][1].__name__, 'method') self.assertEqual(name_values[1][1].__doc__, 'My method') @@ -1626,15 +1626,15 @@ class InterfaceTests(unittest.TestCase): self.assertEqual(len(name_values), 3) self.assertEqual(name_values[0][0], 'attr2') - self.assertTrue(isinstance(name_values[0][1], Attribute)) + self.assertIsInstance(name_values[0][1], Attribute) self.assertEqual(name_values[0][1].__name__, 'attr2') self.assertEqual(name_values[0][1].__doc__, 'My attr2') self.assertEqual(name_values[1][0], 'method') - self.assertTrue(isinstance(name_values[1][1], Method)) + self.assertIsInstance(name_values[1][1], Method) self.assertEqual(name_values[1][1].__name__, 'method') self.assertEqual(name_values[1][1].__doc__, 'My method, overridden') self.assertEqual(name_values[2][0], 'method2') - self.assertTrue(isinstance(name_values[2][1], Method)) + self.assertIsInstance(name_values[2][1], Method) self.assertEqual(name_values[2][1].__name__, 'method2') self.assertEqual(name_values[2][1].__doc__, 'My method2') @@ -1642,19 +1642,19 @@ class InterfaceTests(unittest.TestCase): self.assertEqual(len(name_values), 4) self.assertEqual(name_values[0][0], 'attr') - self.assertTrue(isinstance(name_values[0][1], Attribute)) + self.assertIsInstance(name_values[0][1], Attribute) self.assertEqual(name_values[0][1].__name__, 'attr') self.assertEqual(name_values[0][1].__doc__, 'My attr') self.assertEqual(name_values[1][0], 'attr2') - self.assertTrue(isinstance(name_values[1][1], Attribute)) + self.assertIsInstance(name_values[1][1], Attribute) self.assertEqual(name_values[1][1].__name__, 'attr2') self.assertEqual(name_values[1][1].__doc__, 'My attr2') self.assertEqual(name_values[2][0], 'method') - self.assertTrue(isinstance(name_values[2][1], Method)) + self.assertIsInstance(name_values[2][1], Method) self.assertEqual(name_values[2][1].__name__, 'method') self.assertEqual(name_values[2][1].__doc__, 'My method, overridden') self.assertEqual(name_values[3][0], 'method2') - self.assertTrue(isinstance(name_values[3][1], Method)) + self.assertIsInstance(name_values[3][1], Method) self.assertEqual(name_values[3][1].__name__, 'method2') self.assertEqual(name_values[3][1].__doc__, 'My method2') @@ -1678,12 +1678,12 @@ class InterfaceTests(unittest.TestCase): "My method" a_desc = ISimple.getDescriptionFor('attr') - self.assertTrue(isinstance(a_desc, Attribute)) + self.assertIsInstance(a_desc, Attribute) self.assertEqual(a_desc.__name__, 'attr') self.assertEqual(a_desc.__doc__, 'My attr') m_desc = ISimple.getDescriptionFor('method') - self.assertTrue(isinstance(m_desc, Method)) + self.assertIsInstance(m_desc, Method) self.assertEqual(m_desc.__name__, 'method') self.assertEqual(m_desc.__doc__, 'My method') @@ -1708,22 +1708,22 @@ class InterfaceTests(unittest.TestCase): "My method2" a_desc = IDerived.getDescriptionFor('attr') - self.assertTrue(isinstance(a_desc, Attribute)) + self.assertIsInstance(a_desc, Attribute) self.assertEqual(a_desc.__name__, 'attr') self.assertEqual(a_desc.__doc__, 'My attr') m_desc = IDerived.getDescriptionFor('method') - self.assertTrue(isinstance(m_desc, Method)) + self.assertIsInstance(m_desc, Method) self.assertEqual(m_desc.__name__, 'method') self.assertEqual(m_desc.__doc__, 'My method, overridden') a2_desc = IDerived.getDescriptionFor('attr2') - self.assertTrue(isinstance(a2_desc, Attribute)) + self.assertIsInstance(a2_desc, Attribute) self.assertEqual(a2_desc.__name__, 'attr2') self.assertEqual(a2_desc.__doc__, 'My attr2') m2_desc = IDerived.getDescriptionFor('method2') - self.assertTrue(isinstance(m2_desc, Method)) + self.assertIsInstance(m2_desc, Method) self.assertEqual(m2_desc.__name__, 'method2') self.assertEqual(m2_desc.__doc__, 'My method2') @@ -1747,12 +1747,12 @@ class InterfaceTests(unittest.TestCase): "My method" a_desc = ISimple['attr'] - self.assertTrue(isinstance(a_desc, Attribute)) + self.assertIsInstance(a_desc, Attribute) self.assertEqual(a_desc.__name__, 'attr') self.assertEqual(a_desc.__doc__, 'My attr') m_desc = ISimple['method'] - self.assertTrue(isinstance(m_desc, Method)) + self.assertIsInstance(m_desc, Method) self.assertEqual(m_desc.__name__, 'method') self.assertEqual(m_desc.__doc__, 'My method') @@ -1777,22 +1777,22 @@ class InterfaceTests(unittest.TestCase): "My method2" a_desc = IDerived['attr'] - self.assertTrue(isinstance(a_desc, Attribute)) + self.assertIsInstance(a_desc, Attribute) self.assertEqual(a_desc.__name__, 'attr') self.assertEqual(a_desc.__doc__, 'My attr') m_desc = IDerived['method'] - self.assertTrue(isinstance(m_desc, Method)) + self.assertIsInstance(m_desc, Method) self.assertEqual(m_desc.__name__, 'method') self.assertEqual(m_desc.__doc__, 'My method, overridden') a2_desc = IDerived['attr2'] - self.assertTrue(isinstance(a2_desc, Attribute)) + self.assertIsInstance(a2_desc, Attribute) self.assertEqual(a2_desc.__name__, 'attr2') self.assertEqual(a2_desc.__doc__, 'My attr2') m2_desc = IDerived['method2'] - self.assertTrue(isinstance(m2_desc, Method)) + self.assertIsInstance(m2_desc, Method) self.assertEqual(m2_desc.__name__, 'method2') self.assertEqual(m2_desc.__doc__, 'My method2') @@ -1802,7 +1802,7 @@ class InterfaceTests(unittest.TestCase): class IEmpty(Interface): pass - self.assertFalse('nonesuch' in IEmpty) + self.assertNotIn('nonesuch', IEmpty) def test___contains__simple(self): from zope.interface import Attribute @@ -1814,8 +1814,8 @@ class InterfaceTests(unittest.TestCase): def method(): "My method" - self.assertTrue('attr' in ISimple) - self.assertTrue('method' in ISimple) + self.assertIn('attr', ISimple) + self.assertIn('method', ISimple) def test___contains__derived(self): from zope.interface import Attribute @@ -1836,10 +1836,10 @@ class InterfaceTests(unittest.TestCase): def method2(): "My method2" - self.assertTrue('attr' in IDerived) - self.assertTrue('method' in IDerived) - self.assertTrue('attr2' in IDerived) - self.assertTrue('method2' in IDerived) + self.assertIn('attr', IDerived) + self.assertIn('method', IDerived) + self.assertIn('attr2', IDerived) + self.assertIn('method2', IDerived) def test___iter__empty(self): from zope.interface import Interface @@ -2223,10 +2223,10 @@ class InterfaceTests(unittest.TestCase): class I3(I2): pass - self.assertTrue(I3.get('a') is I1.get('a')) + self.assertIs(I3.get('a'), I1.get('a')) I2.__bases__ = (Interface,) - self.assertTrue(I3.get('a') is None) + self.assertIsNone(I3.get('a')) def test___call___defers_to___conform___(self): from zope.interface import Interface @@ -2254,7 +2254,7 @@ class InterfaceTests(unittest.TestCase): pass c = C() - self.assertTrue(IFoo(c) is c) + self.assertIs(IFoo(c), c) def test___call___miss_wo_alternate(self): from zope.interface import Interface @@ -2278,7 +2278,7 @@ class InterfaceTests(unittest.TestCase): pass c = C() - self.assertTrue(IFoo(c, self) is self) + self.assertIs(IFoo(c, self), self) def test___call___w_adapter_hook(self): from zope.interface import Interface @@ -2301,7 +2301,7 @@ class InterfaceTests(unittest.TestCase): old_adapter_hooks = adapter_hooks[:] adapter_hooks[:] = [_miss, _hit] try: - self.assertTrue(IFoo(c) is self) + self.assertIs(IFoo(c), self) finally: adapter_hooks[:] = old_adapter_hooks diff --git a/contrib/python/zope.interface/py3/zope/interface/tests/test_interfaces.py b/contrib/python/zope.interface/py3/zope/interface/tests/test_interfaces.py index 6c41d49412..a1006493af 100644 --- a/contrib/python/zope.interface/py3/zope/interface/tests/test_interfaces.py +++ b/contrib/python/zope.interface/py3/zope/interface/tests/test_interfaces.py @@ -41,7 +41,7 @@ class ObjectEventTests(unittest.TestCase, _ConformsToIObjectEvent): def test_ctor(self): target = object() event = self._makeOne(target) - self.assertTrue(event.object is target) + self.assertIs(event.object, target) class RegistrationEventTests(unittest.TestCase, diff --git a/contrib/python/zope.interface/py3/zope/interface/tests/test_odd_declarations.py b/contrib/python/zope.interface/py3/zope/interface/tests/test_odd_declarations.py index 75000ddb05..b0f01e9084 100644 --- a/contrib/python/zope.interface/py3/zope/interface/tests/test_odd_declarations.py +++ b/contrib/python/zope.interface/py3/zope/interface/tests/test_odd_declarations.py @@ -94,8 +94,8 @@ class Test(unittest.TestCase): self.assertEqual([i.getName() for i in providedBy(c).flattened()], ['I4', 'I31', 'I3', 'I1', 'I2', 'Interface'] ) - self.assertTrue(I1 in providedBy(c)) - self.assertFalse(I3 in providedBy(c)) + self.assertIn(I1, providedBy(c)) + self.assertNotIn(I3, providedBy(c)) self.assertTrue(providedBy(c).extends(I3)) self.assertTrue(providedBy(c).extends(I31)) self.assertFalse(providedBy(c).extends(I5)) @@ -116,8 +116,8 @@ class Test(unittest.TestCase): ['I4', 'I5', 'I31']) self.assertEqual([i.getName() for i in providedBy(c).flattened()], ['I4', 'I5', 'I31', 'I3', 'Interface']) - self.assertFalse(I1 in providedBy(c)) - self.assertFalse(I3 in providedBy(c)) + self.assertNotIn(I1, providedBy(c)) + self.assertNotIn(I3, providedBy(c)) self.assertTrue(providedBy(c).extends(I3)) self.assertFalse(providedBy(c).extends(I1)) self.assertTrue(providedBy(c).extends(I31)) @@ -138,8 +138,8 @@ class Test(unittest.TestCase): ['I4', 'I5', 'I31']) self.assertEqual([i.getName() for i in providedBy(c).flattened()], ['I4', 'I5', 'I31', 'I3', 'Interface']) - self.assertFalse(I1 in providedBy(c)) - self.assertFalse(I3 in providedBy(c)) + self.assertNotIn(I1, providedBy(c)) + self.assertNotIn(I3, providedBy(c)) self.assertTrue(providedBy(c).extends(I3)) self.assertFalse(providedBy(c).extends(I1)) self.assertTrue(providedBy(c).extends(I31)) @@ -211,19 +211,19 @@ class Test(unittest.TestCase): ob = C() directlyProvides(ob, I1, I2) - self.assertTrue(I1 in providedBy(ob)) - self.assertTrue(I2 in providedBy(ob)) - self.assertTrue(IA1 in providedBy(ob)) - self.assertTrue(IA2 in providedBy(ob)) - self.assertTrue(IB in providedBy(ob)) - self.assertTrue(IC in providedBy(ob)) + self.assertIn(I1, providedBy(ob)) + self.assertIn(I2, providedBy(ob)) + self.assertIn(IA1, providedBy(ob)) + self.assertIn(IA2, providedBy(ob)) + self.assertIn(IB, providedBy(ob)) + self.assertIn(IC, providedBy(ob)) directlyProvides(ob, directlyProvidedBy(ob) - I2) - self.assertTrue(I1 in providedBy(ob)) - self.assertFalse(I2 in providedBy(ob)) - self.assertFalse(I2 in providedBy(ob)) + self.assertIn(I1, providedBy(ob)) + self.assertNotIn(I2, providedBy(ob)) + self.assertNotIn(I2, providedBy(ob)) directlyProvides(ob, directlyProvidedBy(ob), I2) - self.assertTrue(I2 in providedBy(ob)) + self.assertIn(I2, providedBy(ob)) # see above # def TODO_test_classProvides_fails_for_odd_class(self): diff --git a/contrib/python/zope.interface/py3/zope/interface/tests/test_registry.py b/contrib/python/zope.interface/py3/zope/interface/tests/test_registry.py index fbe1ed2b54..0da200ebed 100644 --- a/contrib/python/zope.interface/py3/zope/interface/tests/test_registry.py +++ b/contrib/python/zope.interface/py3/zope/interface/tests/test_registry.py @@ -43,8 +43,8 @@ class ComponentsTests(unittest.TestCase): comp = self._makeOne('testing') self.assertEqual(comp.__name__, 'testing') self.assertEqual(comp.__bases__, ()) - self.assertTrue(isinstance(comp.adapters, AdapterRegistry)) - self.assertTrue(isinstance(comp.utilities, AdapterRegistry)) + self.assertIsInstance(comp.adapters, AdapterRegistry) + self.assertIsInstance(comp.utilities, AdapterRegistry) self.assertEqual(comp.adapters.__bases__, ()) self.assertEqual(comp.utilities.__bases__, ()) self.assertEqual(comp._utility_registrations, {}) @@ -123,7 +123,7 @@ class ComponentsTests(unittest.TestCase): _monkey, _events = self._wrapEvents() with _monkey: comp.registerUtility(_to_reg, ifoo, _name, _info) - self.assertTrue(comp.utilities._adapters[0][ifoo][_name] is _to_reg) + self.assertIs(comp.utilities._adapters[0][ifoo][_name], _to_reg) self.assertEqual(comp._utility_registrations[ifoo, _name], (_to_reg, _info, None)) self.assertEqual(comp.utilities._subscribers[0][ifoo][''], (_to_reg,)) @@ -131,14 +131,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) def test_registerUtility_w_factory(self): from zope.interface.declarations import InterfaceClass @@ -164,14 +164,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _factory) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) def test_registerUtility_no_provided_available(self): @@ -210,14 +210,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) def test_registerUtility_duplicates_existing_reg(self): from zope.interface.declarations import InterfaceClass @@ -305,25 +305,25 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _before) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _before) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) args, kw = _events[1] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _after) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _after) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) def test_registerUtility_w_existing_subscr(self): from zope.interface.declarations import InterfaceClass @@ -463,19 +463,19 @@ class ComponentsTests(unittest.TestCase): unreg = comp.unregisterUtility(_to_reg, ifoo, _name) self.assertTrue(unreg) self.assertFalse(comp.utilities._adapters) # all erased - self.assertFalse((ifoo, _name) in comp._utility_registrations) + self.assertNotIn((ifoo, _name), comp._utility_registrations) self.assertFalse(comp.utilities._subscribers) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIsNone(event.object.factory) def test_unregisterUtility_w_factory(self): from zope.interface.declarations import InterfaceClass @@ -503,13 +503,13 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.factory is _factory) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.factory, _factory) def test_unregisterUtility_wo_explicit_provided(self): from zope.interface.declarations import InterfaceClass @@ -538,14 +538,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) def test_unregisterUtility_wo_component_or_factory(self): from zope.interface.declarations import InterfaceClass @@ -575,14 +575,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, UtilityRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.component is _to_reg) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is None) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) def test_unregisterUtility_w_existing_subscr(self): from zope.interface.declarations import InterfaceClass @@ -738,20 +738,20 @@ class ComponentsTests(unittest.TestCase): comp.registerUtility(_to_reg, ifoo, _name2, _info) reg = sorted(comp.registeredUtilities(), key=lambda r: r.name) self.assertEqual(len(reg), 2) - self.assertTrue(isinstance(reg[0], UtilityRegistration)) - self.assertTrue(reg[0].registry is comp) - self.assertTrue(reg[0].provided is ifoo) - self.assertTrue(reg[0].name is _name1) - self.assertTrue(reg[0].component is _to_reg) - self.assertTrue(reg[0].info is _info) - self.assertTrue(reg[0].factory is None) - self.assertTrue(isinstance(reg[1], UtilityRegistration)) - self.assertTrue(reg[1].registry is comp) - self.assertTrue(reg[1].provided is ifoo) - self.assertTrue(reg[1].name is _name2) - self.assertTrue(reg[1].component is _to_reg) - self.assertTrue(reg[1].info is _info) - self.assertTrue(reg[1].factory is None) + self.assertIsInstance(reg[0], UtilityRegistration) + self.assertIs(reg[0].registry, comp) + self.assertIs(reg[0].provided, ifoo) + self.assertIs(reg[0].name, _name1) + self.assertIs(reg[0].component, _to_reg) + self.assertIs(reg[0].info, _info) + self.assertIsNone(reg[0].factory) + self.assertIsInstance(reg[1], UtilityRegistration) + self.assertIs(reg[1].registry, comp) + self.assertIs(reg[1].provided, ifoo) + self.assertIs(reg[1].name, _name2) + self.assertIs(reg[1].component, _to_reg) + self.assertIs(reg[1].info, _info) + self.assertIsNone(reg[1].factory) def test_queryUtility_miss_no_default(self): from zope.interface.declarations import InterfaceClass @@ -761,7 +761,7 @@ class ComponentsTests(unittest.TestCase): ifoo = IFoo('IFoo') comp = self._makeOne() - self.assertTrue(comp.queryUtility(ifoo) is None) + self.assertIsNone(comp.queryUtility(ifoo)) def test_queryUtility_miss_w_default(self): from zope.interface.declarations import InterfaceClass @@ -772,7 +772,7 @@ class ComponentsTests(unittest.TestCase): ifoo = IFoo('IFoo') comp = self._makeOne() _default = object() - self.assertTrue(comp.queryUtility(ifoo, default=_default) is _default) + self.assertIs(comp.queryUtility(ifoo, default=_default), _default) def test_queryUtility_hit(self): from zope.interface.declarations import InterfaceClass @@ -784,7 +784,7 @@ class ComponentsTests(unittest.TestCase): _to_reg = object() comp = self._makeOne() comp.registerUtility(_to_reg, ifoo) - self.assertTrue(comp.queryUtility(ifoo) is _to_reg) + self.assertIs(comp.queryUtility(ifoo), _to_reg) def test_getUtility_miss(self): from zope.interface.declarations import InterfaceClass @@ -807,7 +807,7 @@ class ComponentsTests(unittest.TestCase): _to_reg = object() comp = self._makeOne() comp.registerUtility(_to_reg, ifoo) - self.assertTrue(comp.getUtility(ifoo) is _to_reg) + self.assertIs(comp.getUtility(ifoo), _to_reg) def test_getUtilitiesFor_miss(self): from zope.interface.declarations import InterfaceClass @@ -902,22 +902,24 @@ class ComponentsTests(unittest.TestCase): _monkey, _events = self._wrapEvents() with _monkey: comp.registerAdapter(_factory, (ibar,), ifoo, _name, _info) - self.assertTrue(comp.adapters._adapters[1][ibar][ifoo][_name] - is _factory) + self.assertIs( + comp.adapters._adapters[1][ibar][ifoo][_name], + _factory + ) self.assertEqual(comp._adapter_registrations[(ibar,), ifoo, _name], (_factory, _info)) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _factory) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) def test_registerAdapter_no_provided_available(self): from zope.interface.declarations import InterfaceClass @@ -958,22 +960,24 @@ class ComponentsTests(unittest.TestCase): _monkey, _events = self._wrapEvents() with _monkey: comp.registerAdapter(_Factory, (ibar,), name=_name, info=_info) - self.assertTrue(comp.adapters._adapters[1][ibar][ifoo][_name] - is _Factory) + self.assertIs( + comp.adapters._adapters[1][ibar][ifoo][_name], + _Factory + ) self.assertEqual(comp._adapter_registrations[(ibar,), ifoo, _name], (_Factory, _info)) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) def test_registerAdapter_no_required_available(self): from zope.interface.declarations import InterfaceClass @@ -1032,8 +1036,9 @@ class ComponentsTests(unittest.TestCase): with _monkey: comp.registerAdapter(_Factory, [None], provided=ifoo, name=_name, info=_info) - self.assertTrue( - comp.adapters._adapters[1][Interface][ifoo][_name] is _Factory + self.assertIs( + comp.adapters._adapters[1][Interface][ifoo][_name], + _Factory ) self.assertEqual( comp._adapter_registrations[(Interface,), ifoo, _name], @@ -1043,14 +1048,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (Interface,)) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) def test_registerAdapter_w_required_containing_class(self): from zope.interface.declarations import InterfaceClass @@ -1080,8 +1085,9 @@ class ComponentsTests(unittest.TestCase): with _monkey: comp.registerAdapter(_Factory, [_Context], provided=ifoo, name=_name, info=_info) - self.assertTrue( - comp.adapters._adapters[1][_ctx_impl][ifoo][_name] is _Factory + self.assertIs( + comp.adapters._adapters[1][_ctx_impl][ifoo][_name], + _Factory ) self.assertEqual( comp._adapter_registrations[(_ctx_impl,), ifoo, _name], @@ -1091,14 +1097,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (_ctx_impl,)) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) def test_registerAdapter_w_required_containing_junk(self): from zope.interface.declarations import InterfaceClass @@ -1141,22 +1147,24 @@ class ComponentsTests(unittest.TestCase): with _monkey: comp.registerAdapter(_Factory, provided=ifoo, name=_name, info=_info) - self.assertTrue(comp.adapters._adapters[1][ibar][ifoo][_name] - is _Factory) + self.assertIs( + comp.adapters._adapters[1][ibar][ifoo][_name], + _Factory + ) self.assertEqual(comp._adapter_registrations[(ibar,), ifoo, _name], (_Factory, _info)) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) - self.assertTrue(event.object.name is _name) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) def test_registerAdapter_wo_event(self): from zope.interface.declarations import InterfaceClass @@ -1238,14 +1246,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_unregisterAdapter_wo_explicit_provided(self): from zope.interface.declarations import InterfaceClass @@ -1273,14 +1281,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_unregisterAdapter_wo_explicit_required(self): from zope.interface.declarations import InterfaceClass @@ -1306,14 +1314,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, AdapterRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_registeredAdapters_empty(self): comp = self._makeOne() @@ -1340,20 +1348,20 @@ class ComponentsTests(unittest.TestCase): comp.registerAdapter(_Factory, (ibar,), ifoo, _name2, _info) reg = sorted(comp.registeredAdapters(), key=lambda r: r.name) self.assertEqual(len(reg), 2) - self.assertTrue(isinstance(reg[0], AdapterRegistration)) - self.assertTrue(reg[0].registry is comp) - self.assertTrue(reg[0].provided is ifoo) + self.assertIsInstance(reg[0], AdapterRegistration) + self.assertIs(reg[0].registry, comp) + self.assertIs(reg[0].provided, ifoo) self.assertEqual(reg[0].required, (ibar,)) - self.assertTrue(reg[0].name is _name1) - self.assertTrue(reg[0].info is _info) - self.assertTrue(reg[0].factory is _Factory) - self.assertTrue(isinstance(reg[1], AdapterRegistration)) - self.assertTrue(reg[1].registry is comp) - self.assertTrue(reg[1].provided is ifoo) + self.assertIs(reg[0].name, _name1) + self.assertIs(reg[0].info, _info) + self.assertIs(reg[0].factory, _Factory) + self.assertIsInstance(reg[1], AdapterRegistration) + self.assertIs(reg[1].registry, comp) + self.assertIs(reg[1].provided, ifoo) self.assertEqual(reg[1].required, (ibar,)) - self.assertTrue(reg[1].name is _name2) - self.assertTrue(reg[1].info is _info) - self.assertTrue(reg[1].factory is _Factory) + self.assertIs(reg[1].name, _name2) + self.assertIs(reg[1].info, _info) + self.assertIs(reg[1].factory, _Factory) def test_queryAdapter_miss_no_default(self): from zope.interface.declarations import InterfaceClass @@ -1364,7 +1372,7 @@ class ComponentsTests(unittest.TestCase): ifoo = IFoo('IFoo') comp = self._makeOne() _context = object() - self.assertTrue(comp.queryAdapter(_context, ifoo) is None) + self.assertIsNone(comp.queryAdapter(_context, ifoo)) def test_queryAdapter_miss_w_default(self): from zope.interface.declarations import InterfaceClass @@ -1376,8 +1384,10 @@ class ComponentsTests(unittest.TestCase): comp = self._makeOne() _context = object() _default = object() - self.assertTrue( - comp.queryAdapter(_context, ifoo, default=_default) is _default) + self.assertIs( + comp.queryAdapter(_context, ifoo, default=_default), + _default + ) def test_queryAdapter_hit(self): from zope.interface.declarations import InterfaceClass @@ -1401,8 +1411,8 @@ class ComponentsTests(unittest.TestCase): comp = self._makeOne() comp.registerAdapter(_Factory, (ibar,), ifoo) adapter = comp.queryAdapter(_context, ifoo) - self.assertTrue(isinstance(adapter, _Factory)) - self.assertTrue(adapter.context is _context) + self.assertIsInstance(adapter, _Factory) + self.assertIs(adapter.context, _context) def test_getAdapter_miss(self): from zope.interface.declarations import InterfaceClass @@ -1590,9 +1600,11 @@ class ComponentsTests(unittest.TestCase): _context2 = _Context2() _default = object() comp = self._makeOne() - self.assertTrue( + self.assertIs( comp.queryMultiAdapter((_context1, _context2), ifoo, - default=_default) is _default) + default=_default), + _default + ) def test_queryMultiAdapter_hit(self): from zope.interface.declarations import InterfaceClass @@ -1623,7 +1635,7 @@ class ComponentsTests(unittest.TestCase): comp = self._makeOne() comp.registerAdapter(_Factory, (ibar, ibaz), ifoo) adapter = comp.queryMultiAdapter((_context1, _context2), ifoo) - self.assertTrue(isinstance(adapter, _Factory)) + self.assertIsInstance(adapter, _Factory) self.assertEqual(adapter.context, (_context1, _context2)) def test_getMultiAdapter_miss(self): @@ -1681,7 +1693,7 @@ class ComponentsTests(unittest.TestCase): comp = self._makeOne() comp.registerAdapter(_Factory, (ibar, ibaz), ifoo) adapter = comp.getMultiAdapter((_context1, _context2), ifoo) - self.assertTrue(isinstance(adapter, _Factory)) + self.assertIsInstance(adapter, _Factory) self.assertEqual(adapter.context, (_context1, _context2)) def _should_not_change(self, comp): @@ -1837,9 +1849,9 @@ class ComponentsTests(unittest.TestCase): found = sorted(comp.getAdapters((_context1, _context2), ifoo)) self.assertEqual(len(found), 2) self.assertEqual(found[0][0], _name1) - self.assertTrue(isinstance(found[0][1], _Factory1)) + self.assertIsInstance(found[0][1], _Factory1) self.assertEqual(found[1][0], _name2) - self.assertTrue(isinstance(found[1][1], _Factory2)) + self.assertIsInstance(found[1][1], _Factory2) def test_registerSubscriptionAdapter_w_nonblank_name(self): from zope.interface.declarations import InterfaceClass @@ -1882,21 +1894,21 @@ class ComponentsTests(unittest.TestCase): info=_info) reg = comp.adapters._subscribers[1][ibar][ifoo][_blank] self.assertEqual(len(reg), 1) - self.assertTrue(reg[0] is _factory) + self.assertIs(reg[0], _factory) self.assertEqual(comp._subscription_registrations, [((ibar,), ifoo, _blank, _factory, _info)]) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, _blank) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _factory) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) def test_registerSubscriptionAdapter_wo_explicit_provided(self): from zope.interface.declarations import InterfaceClass @@ -1922,21 +1934,21 @@ class ComponentsTests(unittest.TestCase): comp.registerSubscriptionAdapter(_Factory, (ibar,), info=_info) reg = comp.adapters._subscribers[1][ibar][ifoo][_blank] self.assertEqual(len(reg), 1) - self.assertTrue(reg[0] is _Factory) + self.assertIs(reg[0], _Factory) self.assertEqual(comp._subscription_registrations, [((ibar,), ifoo, _blank, _Factory, _info)]) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, _blank) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) def test_registerSubscriptionAdapter_wo_explicit_required(self): from zope.interface.declarations import InterfaceClass @@ -1962,21 +1974,21 @@ class ComponentsTests(unittest.TestCase): ) reg = comp.adapters._subscribers[1][ibar][ifoo][_blank] self.assertEqual(len(reg), 1) - self.assertTrue(reg[0] is _Factory) + self.assertIs(reg[0], _Factory) self.assertEqual(comp._subscription_registrations, [((ibar,), ifoo, _blank, _Factory, _info)]) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, _blank) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) def test_registerSubscriptionAdapter_wo_event(self): from zope.interface.declarations import InterfaceClass @@ -2022,20 +2034,20 @@ class ComponentsTests(unittest.TestCase): comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo, info=_info) reg = list(comp.registeredSubscriptionAdapters()) self.assertEqual(len(reg), 2) - self.assertTrue(isinstance(reg[0], SubscriptionRegistration)) - self.assertTrue(reg[0].registry is comp) - self.assertTrue(reg[0].provided is ifoo) + self.assertIsInstance(reg[0], SubscriptionRegistration) + self.assertIs(reg[0].registry, comp) + self.assertIs(reg[0].provided, ifoo) self.assertEqual(reg[0].required, (ibar,)) self.assertEqual(reg[0].name, _blank) - self.assertTrue(reg[0].info is _info) - self.assertTrue(reg[0].factory is _Factory) - self.assertTrue(isinstance(reg[1], SubscriptionRegistration)) - self.assertTrue(reg[1].registry is comp) - self.assertTrue(reg[1].provided is ifoo) + self.assertIs(reg[0].info, _info) + self.assertIs(reg[0].factory, _Factory) + self.assertIsInstance(reg[1], SubscriptionRegistration) + self.assertIs(reg[1].registry, comp) + self.assertIs(reg[1].provided, ifoo) self.assertEqual(reg[1].required, (ibar,)) self.assertEqual(reg[1].name, _blank) - self.assertTrue(reg[1].info is _info) - self.assertTrue(reg[1].factory is _Factory) + self.assertIs(reg[1].info, _info) + self.assertIs(reg[1].factory, _Factory) def test_unregisterSubscriptionAdapter_w_nonblank_name(self): from zope.interface.declarations import InterfaceClass @@ -2111,14 +2123,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is None) + self.assertIsNone(event.object.factory) def test_unregisterSubscriptionAdapter_hit_w_factory(self): from zope.interface.declarations import InterfaceClass @@ -2146,14 +2158,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_unregisterSubscriptionAdapter_wo_explicit_provided(self): from zope.interface.declarations import InterfaceClass @@ -2181,14 +2193,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_unregisterSubscriptionAdapter_wo_explicit_required(self): from zope.interface.declarations import InterfaceClass @@ -2214,14 +2226,14 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, SubscriptionRegistration)) - self.assertTrue(event.object.registry is comp) - self.assertTrue(event.object.provided is ifoo) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) self.assertEqual(event.object.required, (ibar,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_subscribers_empty(self): from zope.interface.declarations import InterfaceClass @@ -2276,8 +2288,8 @@ class ComponentsTests(unittest.TestCase): subscribers = sorted(subscribers, key=_klassname) self.assertEqual(len(subscribers), 2) - self.assertTrue(isinstance(subscribers[0], _Derived)) - self.assertTrue(isinstance(subscribers[1], _Factory)) + self.assertIsInstance(subscribers[0], _Derived) + self.assertIsInstance(subscribers[1], _Factory) def test_registerHandler_w_nonblank_name(self): from zope.interface.declarations import InterfaceClass @@ -2316,20 +2328,20 @@ class ComponentsTests(unittest.TestCase): comp.registerHandler(_factory, (ifoo,), info=_info) reg = comp.adapters._subscribers[1][ifoo][None][_blank] self.assertEqual(len(reg), 1) - self.assertTrue(reg[0] is _factory) + self.assertIs(reg[0], _factory) self.assertEqual(comp._handler_registrations, [((ifoo,), _blank, _factory, _info)]) self.assertEqual(len(_events), 1) args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Registered)) - self.assertTrue(isinstance(event.object, HandlerRegistration)) - self.assertTrue(event.object.registry is comp) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) self.assertEqual(event.object.required, (ifoo,)) self.assertEqual(event.object.name, _blank) - self.assertTrue(event.object.info is _info) - self.assertTrue(event.object.factory is _factory) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) def test_registerHandler_wo_explicit_required_no_event(self): from zope.interface.declarations import InterfaceClass @@ -2351,7 +2363,7 @@ class ComponentsTests(unittest.TestCase): comp.registerHandler(_Factory, info=_info, event=False) reg = comp.adapters._subscribers[1][ifoo][None][_blank] self.assertEqual(len(reg), 1) - self.assertTrue(reg[0] is _Factory) + self.assertIs(reg[0], _Factory) self.assertEqual(comp._handler_registrations, [((ifoo,), _blank, _Factory, _info)]) self.assertEqual(len(_events), 0) @@ -2384,12 +2396,12 @@ class ComponentsTests(unittest.TestCase): subscribers = sorted(comp.registeredHandlers(), key=_factory_name) self.assertEqual(len(subscribers), 2) - self.assertTrue(isinstance(subscribers[0], HandlerRegistration)) + self.assertIsInstance(subscribers[0], HandlerRegistration) self.assertEqual(subscribers[0].required, (ifoo,)) self.assertEqual(subscribers[0].name, '') self.assertEqual(subscribers[0].factory, _factory1) self.assertEqual(subscribers[0].info, '') - self.assertTrue(isinstance(subscribers[1], HandlerRegistration)) + self.assertIsInstance(subscribers[1], HandlerRegistration) self.assertEqual(subscribers[1].required, (ifoo,)) self.assertEqual(subscribers[1].name, '') self.assertEqual(subscribers[1].factory, _factory2) @@ -2446,12 +2458,12 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, HandlerRegistration)) - self.assertTrue(event.object.registry is comp) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) self.assertEqual(event.object.required, (ifoo,)) self.assertEqual(event.object.name, '') - self.assertTrue(event.object.factory is _factory) + self.assertIs(event.object.factory, _factory) def test_unregisterHandler_hit_w_only_explicit_provided(self): from zope.interface.declarations import InterfaceClass @@ -2477,12 +2489,12 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, HandlerRegistration)) - self.assertTrue(event.object.registry is comp) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) self.assertEqual(event.object.required, (ifoo,)) self.assertEqual(event.object.name, '') - self.assertTrue(event.object.factory is None) + self.assertIsNone(event.object.factory) def test_unregisterHandler_wo_explicit_required(self): from zope.interface.declarations import InterfaceClass @@ -2507,13 +2519,13 @@ class ComponentsTests(unittest.TestCase): args, kw = _events[0] event, = args self.assertEqual(kw, {}) - self.assertTrue(isinstance(event, Unregistered)) - self.assertTrue(isinstance(event.object, HandlerRegistration)) - self.assertTrue(event.object.registry is comp) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) self.assertEqual(event.object.required, (ifoo,)) self.assertEqual(event.object.name, '') self.assertEqual(event.object.info, '') - self.assertTrue(event.object.factory is _Factory) + self.assertIs(event.object.factory, _Factory) def test_handle_empty(self): from zope.interface.declarations import InterfaceClass @@ -2802,38 +2814,38 @@ class UtilityRegistrationTests(unittest.TestCase): def test___eq___identity(self): _component = object() ur, _registry, _name = self._makeOne(_component) - self.assertTrue(ur == ur) + self.assertEqual(ur, ur) def test___eq___hit(self): _component = object() ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component) - self.assertTrue(ur == ur2) + self.assertEqual(ur, ur2) def test___eq___miss(self): _component = object() _component2 = object() ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component2) - self.assertFalse(ur == ur2) + self.assertNotEqual(ur, ur2) def test___ne___identity(self): _component = object() ur, _registry, _name = self._makeOne(_component) - self.assertFalse(ur != ur) + self.assertEqual(ur, ur) def test___ne___hit(self): _component = object() ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component) - self.assertFalse(ur != ur2) + self.assertEqual(ur, ur2) def test___ne___miss(self): _component = object() _component2 = object() ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component2) - self.assertTrue(ur != ur2) + self.assertNotEqual(ur, ur2) def test___lt___identity(self): _component = object() @@ -2852,18 +2864,18 @@ class UtilityRegistrationTests(unittest.TestCase): ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component2) ur2.name = _name + '2' - self.assertTrue(ur < ur2) + self.assertLess(ur, ur2) def test___le___identity(self): _component = object() ur, _registry, _name = self._makeOne(_component) - self.assertTrue(ur <= ur) + self.assertLessEqual(ur, ur) def test___le___hit(self): _component = object() ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component) - self.assertTrue(ur <= ur2) + self.assertLessEqual(ur, ur2) def test___le___miss(self): _component = object() @@ -2871,7 +2883,7 @@ class UtilityRegistrationTests(unittest.TestCase): ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component2) ur2.name = _name + '2' - self.assertTrue(ur <= ur2) + self.assertLessEqual(ur, ur2) def test___gt___identity(self): _component = object() @@ -2884,7 +2896,7 @@ class UtilityRegistrationTests(unittest.TestCase): ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component2) ur2.name = _name + '2' - self.assertTrue(ur2 > ur) + self.assertGreater(ur2, ur) def test___gt___miss(self): _component = object() @@ -2895,7 +2907,7 @@ class UtilityRegistrationTests(unittest.TestCase): def test___ge___identity(self): _component = object() ur, _registry, _name = self._makeOne(_component) - self.assertTrue(ur >= ur) + self.assertGreaterEqual(ur, ur) def test___ge___miss(self): _component = object() @@ -2910,7 +2922,7 @@ class UtilityRegistrationTests(unittest.TestCase): ur, _registry, _name = self._makeOne(_component) ur2, _, _ = self._makeOne(_component) ur2.name = _name + '2' - self.assertTrue(ur2 >= ur) + self.assertGreaterEqual(ur2, ur) class AdapterRegistrationTests(unittest.TestCase): @@ -3007,38 +3019,38 @@ class AdapterRegistrationTests(unittest.TestCase): def test___eq___identity(self): _component = object() ar, _registry, _name = self._makeOne(_component) - self.assertTrue(ar == ar) + self.assertEqual(ar, ar) def test___eq___hit(self): _component = object() ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component) - self.assertTrue(ar == ar2) + self.assertEqual(ar, ar2) def test___eq___miss(self): _component = object() _component2 = object() ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component2) - self.assertFalse(ar == ar2) + self.assertNotEqual(ar, ar2) def test___ne___identity(self): _component = object() ar, _registry, _name = self._makeOne(_component) - self.assertFalse(ar != ar) + self.assertEqual(ar, ar) def test___ne___miss(self): _component = object() ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component) - self.assertFalse(ar != ar2) + self.assertEqual(ar, ar2) def test___ne___hit_component(self): _component = object() _component2 = object() ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component2) - self.assertTrue(ar != ar2) + self.assertNotEqual(ar, ar2) def test___ne___hit_provided(self): from zope.interface.declarations import InterfaceClass @@ -3051,7 +3063,7 @@ class AdapterRegistrationTests(unittest.TestCase): ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component) ar2.provided = ibaz - self.assertTrue(ar != ar2) + self.assertNotEqual(ar, ar2) def test___ne___hit_required(self): from zope.interface.declarations import InterfaceClass @@ -3065,7 +3077,7 @@ class AdapterRegistrationTests(unittest.TestCase): ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component2) ar2.required = (ibaz,) - self.assertTrue(ar != ar2) + self.assertNotEqual(ar, ar2) def test___lt___identity(self): _component = object() @@ -3084,18 +3096,18 @@ class AdapterRegistrationTests(unittest.TestCase): ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component2) ar2.name = _name + '2' - self.assertTrue(ar < ar2) + self.assertLess(ar, ar2) def test___le___identity(self): _component = object() ar, _registry, _name = self._makeOne(_component) - self.assertTrue(ar <= ar) + self.assertLessEqual(ar, ar) def test___le___hit(self): _component = object() ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component) - self.assertTrue(ar <= ar2) + self.assertLessEqual(ar, ar2) def test___le___miss(self): _component = object() @@ -3103,7 +3115,7 @@ class AdapterRegistrationTests(unittest.TestCase): ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component2) ar2.name = _name + '2' - self.assertTrue(ar <= ar2) + self.assertLessEqual(ar, ar2) def test___gt___identity(self): _component = object() @@ -3116,7 +3128,7 @@ class AdapterRegistrationTests(unittest.TestCase): ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component2) ar2.name = _name + '2' - self.assertTrue(ar2 > ar) + self.assertGreater(ar2, ar) def test___gt___miss(self): _component = object() @@ -3127,7 +3139,7 @@ class AdapterRegistrationTests(unittest.TestCase): def test___ge___identity(self): _component = object() ar, _registry, _name = self._makeOne(_component) - self.assertTrue(ar >= ar) + self.assertGreaterEqual(ar, ar) def test___ge___miss(self): _component = object() @@ -3142,7 +3154,7 @@ class AdapterRegistrationTests(unittest.TestCase): ar, _registry, _name = self._makeOne(_component) ar2, _, _ = self._makeOne(_component) ar2.name = _name + '2' - self.assertTrue(ar2 >= ar) + self.assertGreaterEqual(ar2, ar) class SubscriptionRegistrationTests(unittest.TestCase): @@ -3229,9 +3241,9 @@ class HandlerRegistrationTests(unittest.TestCase): def _factory(context): raise NotImplementedError() hr, _, _ = self._makeOne(_factory) - self.assertTrue(hr.handler is _factory) - self.assertTrue(hr.factory is hr.handler) - self.assertTrue(hr.provided is None) + self.assertIs(hr.handler, _factory) + self.assertIs(hr.factory, hr.handler) + self.assertIsNone(hr.provided) def test___repr___factory_w_name(self): |