Backported bugfix for tagged values from Zope3.

parent 2de1623f
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
""" """
Revision information: Revision information:
$Id: _Element.py,v 1.4 2003/07/25 13:48:34 anthony Exp $ $Id: _Element.py,v 1.5 2003/07/30 22:09:23 philikon Exp $
""" """
from _object import object from _object import object
...@@ -26,8 +26,6 @@ class Element(object): ...@@ -26,8 +26,6 @@ class Element(object):
# #
#__implements__ = IElement #__implements__ = IElement
__tagged_values = {}
def __init__(self, __name__=None, __doc__=''): def __init__(self, __name__=None, __doc__=''):
"""Create an 'attribute' description """Create an 'attribute' description
""" """
...@@ -37,6 +35,7 @@ class Element(object): ...@@ -37,6 +35,7 @@ class Element(object):
self.__name__=__name__ self.__name__=__name__
self.__doc__=__doc__ self.__doc__=__doc__
self.__tagged_values = {}
def getName(self): def getName(self):
""" Returns the name of the object. """ """ Returns the name of the object. """
......
##############################################################################
#
# Copyright (c) 2001, 2002 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
from Interface._Element import Element
class ElementTests(unittest.TestCase):
def test_taggedValues(self):
"""Test that we can update tagged values of more than one element
"""
e1 = Element("foo")
e2 = Element("bar")
e1.setTaggedValue("x", 1)
e2.setTaggedValue("x", 2)
self.assertEqual(e1.getTaggedValue("x"), 1)
self.assertEqual(e2.getTaggedValue("x"), 2)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(ElementTests))
return suite
def test_suite():
return unittest.makeSuite(ElementTests)
def main():
unittest.TextTestRunner().run(test_suite())
if __name__=="__main__":
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment