[Zope-Checkins] SVN: Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/ Use saner test fixtures from Zope 3 tests (which are undoubtedly

Philipp von Weitershausen philikon at philikon.de
Sun May 21 20:37:12 EDT 2006


Log message for revision 68227:
  Use saner test fixtures from Zope 3 tests (which are undoubtedly
  the offspring of these insane Zope 2 test fixtures).
  

Changed:
  U   Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/__init__.py
  U   Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/testTALES.py

-=-
Modified: Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/__init__.py
===================================================================
--- Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/__init__.py	2006-05-22 00:17:08 UTC (rev 68226)
+++ Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/__init__.py	2006-05-22 00:37:11 UTC (rev 68227)
@@ -1,36 +1 @@
-def all():
-    import testTALES
-    return testTALES.test_suite()
-
-class harness1:
-    def __init__(self):
-        self.__callstack = []
-
-    def _assert_(self, name, *args, **kwargs):
-        self.__callstack.append((name, args, kwargs))
-
-    def _complete_(self):
-        assert len(self.__callstack) == 0, "Harness methods called"
-
-    def __getattr__(self, name):
-        cs = self.__callstack
-        assert len(cs), 'Unexpected harness method call "%s".' % name
-        assert cs[0][0] == name, (
-            'Harness method name "%s" called, "%s" expected.' %
-            (name, cs[0][0]) )
-        return self._method_
-
-    def _method_(self, *args, **kwargs):
-        name, aargs, akwargs = self.__callstack.pop(0)
-        assert aargs == args, "Harness method arguments"
-        assert akwargs == kwargs, "Harness method keyword args"
-
-class harness2(harness1):
-    def _assert_(self, name, result, *args, **kwargs):
-        self.__callstack.append((name, result, args, kwargs))
-
-    def _method_(self, *args, **kwargs):
-        name, result, aargs, akwargs = self.__callstack.pop(0)
-        assert aargs == args, "Harness method arguments"
-        assert akwargs == kwargs, "Harness method keyword args"
-        return result
+# make this directory a package

Modified: Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/testTALES.py
===================================================================
--- Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/testTALES.py	2006-05-22 00:17:08 UTC (rev 68226)
+++ Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/testTALES.py	2006-05-22 00:37:11 UTC (rev 68227)
@@ -1,7 +1,7 @@
 import os, sys, unittest
 
 from Products.PageTemplates import TALES
-from Products.PageTemplates.tests import harness1
+from zope.tales.tests.test_tales import Harness
 import string
 
 class DummyUnicodeExpr:
@@ -18,14 +18,14 @@
 
     def testIterator0(self):
         '''Test sample Iterator class'''
-        context = harness1()
+        context = Harness(self)
         it = TALES.Iterator('name', (), context)
         assert not it.next(), "Empty iterator"
         context._complete_()
 
     def testIterator1(self):
         '''Test sample Iterator class'''
-        context = harness1()
+        context = Harness(self)
         it = TALES.Iterator('name', (1,), context)
         context._assert_('setLocal', 'name', 1)
         assert it.next() and not it.next(), "Single-element iterator"
@@ -33,7 +33,7 @@
 
     def testIterator2(self):
         '''Test sample Iterator class'''
-        context = harness1()
+        context = Harness(self)
         it = TALES.Iterator('text', 'text', context)
         for c in 'text':
             context._assert_('setLocal', 'text', c)



More information about the Zope-Checkins mailing list