[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate/tests - sample.py:1.1.2.1 test.pt:1.1.2.1 testBoundPageTemplate.py:1.1.2.1
Jim Fulton
jim@zope.com
Fri, 28 Dec 2001 10:34:43 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv9515
Added Files:
Tag: Zope-3x-branch
sample.py test.pt testBoundPageTemplate.py
Log Message:
Added tests for fix to BoundPageTemplates to prevent simple attribute setting.
=== Added File Zope3/lib/python/Zope/PageTemplate/tests/sample.py ===
##############################################################################
#
# Copyright (c) 2001 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
#
##############################################################################
"""
Revision information: $Id: sample.py,v 1.1.2.1 2001/12/28 15:34:43 jim Exp $
"""
import os
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
class C:
index = PageTemplateFile('test.pt',
'%s/www' % os.path.dirname(__file__)
)
=== Added File Zope3/lib/python/Zope/PageTemplate/tests/test.pt ===
<html><body></body></html>
=== Added File Zope3/lib/python/Zope/PageTemplate/tests/testBoundPageTemplate.py ===
##############################################################################
#
# Copyright (c) 2001 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
#
##############################################################################
import unittest, sys, os
class Test(unittest.TestCase):
def testAttributes(self):
from sample import C
self.assertRaises(AttributeError, setattr, C.index, 'foo', 1)
self.assertRaises(AttributeError, setattr, C().index, 'foo', 1)
C.index.im_func.foo = 1
self.assertEqual(C.index.foo, 1)
def test_suite():
loader=unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())