[Zodb-checkins] CVS: Zope/lib/Components/ExtensionClass/test - test_acquisition.py:1.3.38.1

Shane Hathaway shane@digicool.com
Fri, 14 Sep 2001 16:06:00 -0400


Update of /cvs-repository/Zope/lib/Components/ExtensionClass/test
In directory cvs.zope.org:/tmp/cvs-serv1123/ExtensionClass/test

Modified Files:
      Tag: Zope-2_4-branch
	test_acquisition.py 
Log Message:
Merge from trunk


=== Zope/lib/Components/ExtensionClass/test/test_acquisition.py 1.3 => 1.3.38.1 ===
 assert( b.c.d == b.c )
 assert( b.c == c )
+
+
+def checkContext(self, o):
+    # Python equivalent to aq_inContextOf
+    from Acquisition import aq_base, aq_parent, aq_inner
+    subob = self
+    o = aq_base(o)
+    while 1:
+      if aq_base(subob) is o: return 1
+      self = aq_inner(subob)
+      if self is None: break
+      subob = aq_parent(self)
+      if subob is None: break
+
+
+assert checkContext(b.c, b)
+assert not checkContext(b.c, b.a)
+
+assert b.a.aq_inContextOf(b)
+assert b.c.aq_inContextOf(b)
+assert b.c.d.aq_inContextOf(b)
+assert b.c.d.aq_inContextOf(c)
+assert b.c.d.aq_inContextOf(b.c)
+assert not b.c.aq_inContextOf(foo)
+assert not b.c.aq_inContextOf(b.a)
+assert not b.a.aq_inContextOf('somestring')