[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate/tests - test_talesapi.py:1.5.2.1 test_directives.py:1.2.10.1 test_viewzpt.py:1.6.10.1

Grégoire Weber zope@i-con.ch
Sun, 22 Jun 2003 10:24:18 -0400


Update of /cvs-repository/Zope3/src/zope/app/pagetemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv24874/src/zope/app/pagetemplate/tests

Modified Files:
      Tag: cw-mail-branch
	test_directives.py test_viewzpt.py 
Added Files:
      Tag: cw-mail-branch
	test_talesapi.py 
Log Message:
Synced up with HEAD

=== Added File Zope3/src/zope/app/pagetemplate/tests/test_talesapi.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tales API Tests

$Id: test_talesapi.py,v 1.5.2.1 2003/06/22 14:23:18 gregweb Exp $
"""

from zope.testing.doctestunit import DocTestSuite
from zope.interface import implements
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.interfaces.size import ISized
from zope.app.interfaces.traversing import IPhysicallyLocatable
from datetime import datetime
from zope.app.pagetemplate.talesapi import ZopeTalesAPI

class TestObject(object):

    implements(IZopeDublinCore, # not really, but who's checking. ;)
               IPhysicallyLocatable, # not really
               ISized)

    description = u"This object stores some number of apples"
    title = u"apple cart"
    created = datetime(2000, 10, 1, 23, 11, 00)
    modified = datetime(2003, 1, 2, 3, 4, 5)

    def sizeForSorting(self):
        return u'apples', 5

    def sizeForDisplay(self):
        return u'5 apples'

    def getName(self):
        return u'apples'

testObject = TestObject()

def title():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.title
    u'apple cart'
    """

def title():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.description
    u'This object stores some number of apples'
    """

def name():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.name()
    u'apples'
    """

def title_or_name():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.title_or_name()
    u'apple cart'

    >>> testObject.title = u""
    >>> api = ZopeTalesAPI(testObject)
    >>> api.title_or_name()
    u'apples'
    """

def size():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.size()
    u'5 apples'
    """

def modified():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.modified
    datetime.datetime(2003, 1, 2, 3, 4, 5)
    """

def created():
    """
    >>> api = ZopeTalesAPI(testObject)
    >>> api.created
    datetime.datetime(2000, 10, 1, 23, 11)
    """


def test_suite():
    return DocTestSuite()

if __name__ == '__main__':
    unittest.main()


=== Zope3/src/zope/app/pagetemplate/tests/test_directives.py 1.2 => 1.2.10.1 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_directives.py:1.2	Thu May  1 15:35:26 2003
+++ Zope3/src/zope/app/pagetemplate/tests/test_directives.py	Sun Jun 22 10:23:18 2003
@@ -23,7 +23,7 @@
 
 from zope.app.tests.placelesssetup import PlacelessSetup
 
-from zope.interface import Interface
+from zope.interface import Interface, implements
 from zope.component.adapter import provideAdapter
 from zope.app.interfaces.traversing import ITraversable
 
@@ -42,7 +42,7 @@
     pass
 
 class Adapter:
-    __implements__ = (I, ITraversable)
+    implements(I, ITraversable)
 
     def __init__(self, context):
         pass


=== Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py 1.6 => 1.6.10.1 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py:1.6	Thu May  1 15:35:26 2003
+++ Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py	Sun Jun 22 10:23:18 2003
@@ -15,7 +15,7 @@
 
 from zope.component import getService
 from zope.app.services.servicenames import Views
-from zope.interface import Interface
+from zope.interface import Interface, implements
 
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.services.tests.placefulsetup import PlacefulSetup
@@ -25,7 +25,7 @@
     pass
 
 class C1:
-    __implements__ = I1
+    implements(I1)
 
 class InstanceWithContext:
     def __init__(self, context):
@@ -73,7 +73,7 @@
              import IPresentationRequest
 
         class MyRequest:
-            __implements__ = IPresentationRequest
+            implements(IPresentationRequest)
             def getPresentationType(self):
                 return the_view_type
             def getPresentationSkin(self):