27 Sep
2005
27 Sep
'05
5:21 p.m.
Florent Guillaume wrote at 2005-9-26 18:31 +0200:
This is the kind of thing that would *really* benefit from having unit tests...
from Acquisition import Explicit class A(Explicit): x = 1 ... def test_aq_acquire(self): ac = A() a = A().__of__(ac) self.assertEqual(a.aq_acquire('x'), 1) self.assertRaises(AttributeError, a.aq_acquire, 'y') self.assertEqual(a.aq_acquire('y', default=None), None) Note, that "aq_acquire" has a lot more arguments -- not checked by the above test (which checks just the fixed handling of the argument "default"). -- Dieter