On 05/07/2013 11:26, "Martin v. Löwis" wrote:
...
A.__getattribute__(A,'s')
<staticmethod object at 0x100937828>
A.__getattribute__(A,'c')
<classmethod object at 0x100937860>
A.__getattribute__(A,'r')
<function A.r at 0x100938378>

Okay, but with this line:

found = found.__getattribute__(found, n)

I get a tonne of failures like this:

File "<doctest testfixtures.tests.test_replacer.TestReplacer.test_with_statement[3]>", line 2, in <module>
        r.replace('testfixtures.tests.sample1.z',test_z)
File "/Users/chris/LocalGIT/testfixtures/testfixtures/replace.py", line 50, in replace
        container, method, attribute, t_obj = resolve(target)
File "/Users/chris/LocalGIT/testfixtures/testfixtures/resolve.py", line 17, in resolve
        found = found.__getattribute__(found, n)
    TypeError: expected 1 arguments, got 2

If I change it to :

found = found.__getattribute__(n)

I get fewer failures, but still plenty, now of the form:

File "<doctest testfixtures.tests.test_replacer.TestReplacer.test_multiple_replace[7]>", line 1, in <module>
        r.replace('testfixtures.tests.sample1.X.y',test_y)
File "/Users/chris/LocalGIT/testfixtures/testfixtures/replace.py", line 50, in replace
        container, method, attribute, t_obj = resolve(target)
File "/Users/chris/LocalGIT/testfixtures/testfixtures/resolve.py", line 17, in resolve
        found = found.__getattribute__(n)
    TypeError: expected 1 arguments, got 0

...so I'm back to:

found = found.__dict__[n]

...and having to catch both KeyError and AttributeError.

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to