[Zope-dev] Re: SVN: Zope/branches/Zope-2_8-branch/ - Collector #1879: applied patch by Dieter Maurer to fix a bug in

Dieter Maurer dieter at handshake.de
Tue Sep 27 13:21:12 EDT 2005


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


More information about the Zope-Dev mailing list