diff options
| author | Barry Warsaw <barry@python.org> | 2001-01-15 21:00:02 +0000 |
|---|---|---|
| committer | Barry Warsaw <barry@python.org> | 2001-01-15 21:00:02 +0000 |
| commit | 8a34ebcc3095f326f21f0dddc52d4c3a7070c513 (patch) | |
| tree | 39f4448a51acf4286480e61fa1bcd96a0d7d471b /Lib | |
| parent | d16a23937cf596fdfd800b4d7fa47a537bf7a069 (diff) | |
| download | cpython-8a34ebcc3095f326f21f0dddc52d4c3a7070c513.tar.gz | |
Add a test case suggested by Guido, where a method is created with the
new module.
Diffstat (limited to 'Lib')
| -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 f8b471e120..9d3ec18a2f 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 |
