diff options
| author | Jason Madden <jamadden@gmail.com> | 2017-06-29 12:44:25 -0500 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2017-06-30 11:01:09 -0500 |
| commit | 712bb8e078de20e01311cfe57d8dccfbbdcbe9b3 (patch) | |
| tree | 4cb7d4e9cc901fe144d168b77eea235a08932787 /src/zope/component/tests/test_factory.py | |
| parent | 43d7351318eb373d1f4f500b70e4e461048c16f4 (diff) | |
| download | zope-component-issue29.tar.gz | |
100% coverageissue29
Add change note and badge to readme.
Remove unused class and function.
Omit standalonetests.py entirely from coverage.
Another unused class.
Incorporate feedback in test__api.py
* Bring back _callFUT and make the queryAdapterInContext tests call it
* Change raise NotImplentedError into specific fails_if_called() calls.
Remove redundant argument now that all test in Test_adapts pass under all versions.
Remove NotImplementedError from test_globalregistry.py
Remove NotImplementedError from test_hookable.py
Remove NotImplementedError from test_registry.py
Remove NotImplementedError from test_security.py
Remove NotImplementedError from test_zcml.py
Remove NotImplementedError from test_factory.py
Document ZCML feature and devmode.
Really accept all arguments unless opted out.
Diffstat (limited to 'src/zope/component/tests/test_factory.py')
| -rw-r--r-- | src/zope/component/tests/test_factory.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/zope/component/tests/test_factory.py b/src/zope/component/tests/test_factory.py index cda0191..7c487b5 100644 --- a/src/zope/component/tests/test_factory.py +++ b/src/zope/component/tests/test_factory.py @@ -15,6 +15,7 @@ """ import unittest +from zope.component.tests import fails_if_called class FactoryTests(unittest.TestCase): @@ -24,7 +25,7 @@ class FactoryTests(unittest.TestCase): def _makeOne(self, callable=None, *args, **kw): if callable is None: - callable = _test_callable + callable = fails_if_called(self) return self._getTargetClass()(callable, *args, **kw) def test_class_conforms_to_IFactory(self): @@ -38,14 +39,15 @@ class FactoryTests(unittest.TestCase): verifyObject(IFactory, self._makeOne()) def test_ctor_defaults(self): - factory = self._makeOne() - self.assertEqual(factory._callable, _test_callable) + func = fails_if_called(self) + factory = self._makeOne(func) + self.assertEqual(factory._callable, func) self.assertEqual(factory.title, '') self.assertEqual(factory.description, '') self.assertEqual(factory._interfaces, None) def test_ctor_expclit(self): - factory = self._makeOne(_test_callable, 'TITLE', 'DESCRIPTION') + factory = self._makeOne(fails_if_called(self), 'TITLE', 'DESCRIPTION') self.assertEqual(factory.title, 'TITLE') self.assertEqual(factory.description, 'DESCRIPTION') @@ -82,9 +84,9 @@ class FactoryTests(unittest.TestCase): pass class IBaz(Interface): pass - @implementer(IBaz) - def _callable(): - pass + _callable = fails_if_called(self) + _callable.__name__ = '_callable' + _callable = implementer(IBaz)(_callable) factory = self._makeOne(_callable, interfaces=(IFoo, IBar)) spec = factory.getInterfaces() self.assertEqual(spec.__name__, '_callable') @@ -95,17 +97,7 @@ class FactoryTests(unittest.TestCase): from zope.interface import implementer class IBaz(Interface): pass - @implementer(IBaz) - def _callable(): - pass + _callable = implementer(IBaz)(fails_if_called(self)) factory = self._makeOne(_callable) spec = factory.getInterfaces() self.assertEqual(list(spec), [IBaz]) - -def _test_callable(*args, **kw): - pass - -def test_suite(): - return unittest.TestSuite(( - unittest.makeSuite(FactoryTests), - )) |
