/usr/share/pyshared/zope/app/pagetemplate/tests/test_talesapi.py is in python-zope.app.pagetemplate 3.11.2-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | ##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 116904 2010-09-25 13:20:53Z icemac $
"""
from datetime import datetime
from doctest import DocTestSuite
from zope.interface import implements
from zope.size.interfaces import ISized
from zope.traversing.interfaces import IPhysicallyLocatable
from zope.dublincore.interfaces import IZopeDublinCore
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 description():
"""
>>> 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 = TestObject()
>>> 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()
|