diff options
| author | Jason Madden <jamadden@gmail.com> | 2020-03-05 14:38:39 -0600 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2020-03-15 09:56:14 -0500 |
| commit | 024f6432270afd021da2d9fff5c3f496f788e54d (patch) | |
| tree | d9732ae94de818f2e3ea8ac144e1b932cbefa133 /src/zope/interface/tests/test_interface.py | |
| parent | 354faccebd5b612a2ac8e081a7e5d2f7fb1089c1 (diff) | |
| download | zope-interface-issue21.tar.gz | |
Use C3 (mostly) to compute IRO.issue21
Fixes #21
The 'mostly' is because interfaces are used in cases that C3 forbids;
when there's a conflict, we fallback to the legacy algorithm. It turns
out there are few conflicts (13K out of 149K total orderings in Plone).
I hoped the fix for #8 might shake out automatically, but it didn't.
Optimize the extremely common case of a __bases__ of length one.
In the benchmark, 4/5 of the interfaces and related objects have a base of length one.
Fix the bad IROs in the bundled ABC interfaces, and implement a way to get warnings or errors.
In running plone/buildout.coredev and tracking the RO requests, the
stats for equal, not equal, and inconsistent-so-fallback, I got
{'ros': 148868, 'eq': 138461, 'ne': 10407, 'inconsistent': 12934}
Add the interface module to the Attribute str.
This was extremely helpful tracking down the Plone problem; IDate is defined in multiple modules.
Diffstat (limited to 'src/zope/interface/tests/test_interface.py')
| -rw-r--r-- | src/zope/interface/tests/test_interface.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/zope/interface/tests/test_interface.py b/src/zope/interface/tests/test_interface.py index 7bde955..df7f84b 100644 --- a/src/zope/interface/tests/test_interface.py +++ b/src/zope/interface/tests/test_interface.py @@ -1911,7 +1911,7 @@ class AttributeTests(ElementTests): method.interface = type(self) r = repr(method) self.assertTrue(r.startswith('<zope.interface.interface.Attribute object at'), r) - self.assertTrue(r.endswith(' AttributeTests.TestAttribute>'), r) + self.assertTrue(r.endswith(' ' + __name__ + '.AttributeTests.TestAttribute>'), r) def test__repr__wo_interface(self): method = self._makeOne() @@ -1923,7 +1923,7 @@ class AttributeTests(ElementTests): method = self._makeOne() method.interface = type(self) r = str(method) - self.assertEqual(r, 'AttributeTests.TestAttribute') + self.assertEqual(r, __name__ + '.AttributeTests.TestAttribute') def test__str__wo_interface(self): method = self._makeOne() @@ -1998,7 +1998,7 @@ class MethodTests(AttributeTests): method.interface = type(self) r = repr(method) self.assertTrue(r.startswith('<zope.interface.interface.Method object at'), r) - self.assertTrue(r.endswith(' MethodTests.TestMethod(**kw)>'), r) + self.assertTrue(r.endswith(' ' + __name__ + '.MethodTests.TestMethod(**kw)>'), r) def test__repr__wo_interface(self): method = self._makeOne() @@ -2012,7 +2012,7 @@ class MethodTests(AttributeTests): method.kwargs = 'kw' method.interface = type(self) r = str(method) - self.assertEqual(r, 'MethodTests.TestMethod(**kw)') + self.assertEqual(r, __name__ + '.MethodTests.TestMethod(**kw)') def test__str__wo_interface(self): method = self._makeOne() |
