Commit 5d028e57 authored by Jeremy Hylton's avatar Jeremy Hylton

looks like this test only worked with 2.1 because 2.1 supports func attrs

parent 32574117
test_func_attr
Trying function wo attributes
Trying method wo attributes
Trying setting function attribute
Trying function w attributes
Trying method w attributes
Trying method getattr
......@@ -7,7 +7,7 @@ import test.regrtest
ec_tests = ["test_AqAlg", "test_MultiMapping", "test_Sync",
"test_ThreadLock", "test_acquisition", "test_add",
"test_binding", "test_explicit_acquisition",
"test_func_attr", "test_method_hook"]
"test_method_hook"]
ec_testdir = os.path.split(sys.argv[0])[0] or '.'
......
#! /usr/bin/env python
"""Test function attributes
Jim Fulton
"""
verbose=1
from ExtensionClass import Base
def f(a): return a*a
class C(Base):
def m(self, a): return a*a
m.spam='eggs'
i=C()
if verbose: print 'Trying function wo attributes'
if f(2) != 4: print 'failed'
if verbose: print 'Trying method wo attributes'
if i.m(2) != 4: print 'failed'
if verbose: print 'Trying setting function attribute'
f.spam='eggs'
if verbose: print 'Trying function w attributes'
if f(2) != 4: print 'failed'
if verbose: print 'Trying method w attributes'
if i.m(2) != 4: print 'failed'
if verbose: print 'Trying method getattr'
try:
if i.m.spam != 'eggs': print 'failed'
except AttributeError: print 'failed'
try:
i.m.foo
print 'failed'
except AttributeError: pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment