projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
309b566
)
Add early binding of methods to the 2nd metaclass example.
author
Guido van Rossum
<guido@python.org>
Fri, 17 Aug 2001 11:55:58 +0000
(11:55 +0000)
committer
Guido van Rossum
<guido@python.org>
Fri, 17 Aug 2001 11:55:58 +0000
(11:55 +0000)
Lib/test/test_descr.py
patch
|
blob
|
history
diff --git
a/Lib/test/test_descr.py
b/Lib/test/test_descr.py
index 247a4c49b3c244d92f71abddd1f48d2efcb46d43..a26a1e28f49c45f701f3ee73513c4f6d300e2dd6 100644
(file)
--- a/
Lib/test/test_descr.py
+++ b/
Lib/test/test_descr.py
@@
-404,7
+404,11
@@
def metaclass():
__new__ = staticmethod(__new__)
def __call__(self):
it = _instance()
- # XXX Should do more, but that doesn't work yet
+ # Early binding of methods
+ for key in self.dict:
+ if key.startswith("__"):
+ continue
+ setattr(it, key, self.dict[key].__get__(it, self))
return it
class C:
__metaclass__ = M2
@@
-414,6
+418,7
@@
def metaclass():
verify(C.bases == ())
verify('spam' in C.dict)
c = C()
+ verify(c.spam() == 42)
def pymods():
if verbose: print "Testing Python subclass of module..."