Skip to content

Commit

Permalink
cleanups requested by @tseaver: remove assert from _implements since …
Browse files Browse the repository at this point in the history
…all its callers already do this guard; be more explicit about ClassType in test_odd_declarations
  • Loading branch information
jamadden committed Jun 14, 2017
1 parent 3a1a264 commit 06ba129
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/zope/interface/declarations.py
Expand Up @@ -436,7 +436,6 @@ def __call__(self, ob):
def _implements(name, interfaces, classImplements):
# This entire approach is invalid under Py3K. Don't even try to fix
# the coverage for this block there. :(
assert not PYTHON3, "Class advice impossible in Python 3"
frame = sys._getframe(2)
locals = frame.f_locals

Expand Down
7 changes: 5 additions & 2 deletions src/zope/interface/tests/test_odd_declarations.py
Expand Up @@ -257,9 +257,12 @@ class C(A, B):
self.assertEqual(c.c, 1)
c.c

import sys
if sys.version_info[0] < 3: # This test only makes sense under Python 2.x
try:
from types import ClassType
except ImportError:
pass
else:
# This test only makes sense under Python 2.x
assert not isinstance(C, (type, ClassType))

self.assertIs(C.__class__.__class__, C.__class__)

0 comments on commit 06ba129

Please sign in to comment.