diff options
author | Barry Warsaw <barry@python.org> | 2001-01-15 21:00:02 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-01-15 21:00:02 (GMT) |
commit | 534c60f9ab1e2bba453690e659d2a86f3ad6439d (patch) | |
tree | 4a8937509020e4d17522fce4eeb4a23ff7f8e3d0 | |
parent | 83ad5015cbba461cfe1f8f7185b350dc5e7a949d (diff) | |
download | cpython-534c60f9ab1e2bba453690e659d2a86f3ad6439d.zip cpython-534c60f9ab1e2bba453690e659d2a86f3ad6439d.tar.gz cpython-534c60f9ab1e2bba453690e659d2a86f3ad6439d.tar.bz2 |
Add a test case suggested by Guido, where a method is created with the
new module.
-rw-r--r-- | Lib/test/test_funcattrs.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py index f8b471e..9d3ec18 100644 --- a/Lib/test/test_funcattrs.py +++ b/Lib/test/test_funcattrs.py @@ -100,3 +100,41 @@ else: if f2.a.one <> f1.a.one <> F.a.one <> 11: raise TestFailed + +# im_func may not be a Python method! +import new +F.id = new.instancemethod(id, None, F) + +eff = F() +if eff.id() <> id(eff): + raise TestFailed + +try: + F.id.foo +except AttributeError: pass +else: raise TestFailed + +try: + F.id.foo = 12 +except TypeError: pass +else: raise TestFailed + +try: + F.id.foo +except AttributeError: pass +else: raise TestFailed + +try: + eff.id.foo +except AttributeError: pass +else: raise TestFailed + +try: + eff.id.foo = 12 +except TypeError: pass +else: raise TestFailed + +try: + eff.id.foo +except AttributeError: pass +else: raise TestFailed |