Permalink
Browse files

Unbound methods are gone in Py3 so there is no easy way to support 'o…

…verridden' function

for unbound methods in Py3 because they look like regular functions and doesn't store reference to a class.
That feature is not used in NLTK own codebase so I removed it from tests. This make 'nltk.internals' tests
("tox -- nltk.internals internals.doctest") pass for all platforms.
  • Loading branch information...
1 parent 466fa46 commit b3fc440fc3b9bfb31ab7e6863fc1960468dca9a6 @kmike committed May 18, 2012
Showing with 4 additions and 24 deletions.
  1. +4 −24 nltk/test/internals.doctest
@@ -33,7 +33,7 @@ perform the other method:
'yum'
>>> GoodEater1().batch_eat(['steak', 'peas'])
['yum', 'yum']
-
+
>>> class GoodEater2(EaterI):
... def batch_eat(self, foods):
... return ['yum' for food in foods]
@@ -79,12 +79,12 @@ It's ok to use intermediate abstract classes:
>>> class GoodEater3(AbstractEater):
... def eat(self, food):
... return 'yum'
- ...
+ ...
>>> GoodEater3().eat('steak')
'yum'
>>> GoodEater3().batch_eat(['steak', 'peas'])
['yum', 'yum']
-
+
>>> class GoodEater4(AbstractEater):
... def batch_eat(self, foods):
... return ['yum' for food in foods]
@@ -122,19 +122,8 @@ Here's some extra tests:
>>> overridden(D().f)
True
-overridden() can be called on unbound methods as well:
-
- >>> overridden(A.f)
- False
- >>> overridden(B.f)
- True
- >>> overridden(C.f)
- False
- >>> overridden(D.f)
- True
-
It works for classic classes, too:
-
+
>>> class A:
... def f(x): pass
>>> class B(A):
@@ -149,12 +138,3 @@ It works for classic classes, too:
False
>>> overridden(D().f)
True
- >>> overridden(A.f)
- False
- >>> overridden(B.f)
- True
- >>> overridden(C.f)
- False
- >>> overridden(D.f)
- True
-

0 comments on commit b3fc440

Please sign in to comment.