[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/tests - testBrowserWidget.py:1.1.4.2 testTextWidget.py:1.1.4.2
Jeremy Hylton
jeremy@zope.com
Tue, 4 Jun 2002 12:28:19 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv4032/Widgets/Browser/tests
Modified Files:
Tag: Zope-3x-branch
testBrowserWidget.py testTextWidget.py
Log Message:
Fix line endings
=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/tests/testBrowserWidget.py 1.1.4.1 => 1.1.4.2 ===
#
##############################################################################
-"""
-
-$Id$
-"""
-import unittest
-from Zope.App.Formulator import Errors
-
-
-class ContentObject:
- """Class to provide a stub for a field"""
-
- def getFoo(self):
- """ """
- return "Foo Value"
-
-
-class Field:
- """Field Stub """
-
- id = 'foo'
-
- def __init__(self, context):
- """ """
- self._context = context
-
-
- def getPropertyInContext(self):
- """ """
- return self._context.getFoo()
-
-
-
-
-class Test(unittest.TestCase):
-
-
- def setUp(self):
-
- from Zope.App.Formulator.Widgets.Browser import BrowserWidget
- obj = ContentObject()
- field = Field(obj)
- self._widget = BrowserWidget.BrowserWidget(field)
-
-
- def testProperties(self):
-
- self.assertEqual(self._widget.getValue('tag'), 'input')
- self.assertEqual(self._widget.getValue('type'), 'text')
- self.assertEqual(self._widget.getValue('cssClass'), '')
- self.assertEqual(self._widget.getValue('hidden'), 0)
- self.assertEqual(self._widget.getValue('extra'), '')
-
-
- def testRendering(self):
-
-
- request = {'field_foo': 'Foo Value'}
-
- self.assertEqual(self._widget.render(request),
- '<input type="text" name="field_foo" '
- 'value="Foo Value" />')
-
- self.assertEqual(self._widget.render_hidden(request),
- '<input type="hidden" name="field_foo" '
- 'value="Foo Value" />')
-
- self._widget.extra = '''style="color: red"'''
- self.assertEqual(self._widget.render_hidden(request),
- '<input type="hidden" name="field_foo" '
- 'value="Foo Value" style="color: red" />')
-
-
-def test_suite():
- loader = unittest.TestLoader()
- return loader.loadTestsFromTestCase( Test )
-
-if __name__=='__main__':
- unittest.TextTestRunner().run( test_suite() )
-
-
-
-
-
+"""
+
+$Id$
+"""
+import unittest
+from Zope.App.Formulator import Errors
+
+
+class ContentObject:
+ """Class to provide a stub for a field"""
+
+ def getFoo(self):
+ """ """
+ return "Foo Value"
+
+
+class Field:
+ """Field Stub """
+
+ id = 'foo'
+
+ def __init__(self, context):
+ """ """
+ self._context = context
+
+
+ def getPropertyInContext(self):
+ """ """
+ return self._context.getFoo()
+
+
+
+
+class Test(unittest.TestCase):
+
+
+ def setUp(self):
+
+ from Zope.App.Formulator.Widgets.Browser import BrowserWidget
+ obj = ContentObject()
+ field = Field(obj)
+ self._widget = BrowserWidget.BrowserWidget(field)
+
+
+ def testProperties(self):
+
+ self.assertEqual(self._widget.getValue('tag'), 'input')
+ self.assertEqual(self._widget.getValue('type'), 'text')
+ self.assertEqual(self._widget.getValue('cssClass'), '')
+ self.assertEqual(self._widget.getValue('hidden'), 0)
+ self.assertEqual(self._widget.getValue('extra'), '')
+
+
+ def testRendering(self):
+
+
+ request = {'field_foo': 'Foo Value'}
+
+ self.assertEqual(self._widget.render(request),
+ '<input type="text" name="field_foo" '
+ 'value="Foo Value" />')
+
+ self.assertEqual(self._widget.render_hidden(request),
+ '<input type="hidden" name="field_foo" '
+ 'value="Foo Value" />')
+
+ self._widget.extra = '''style="color: red"'''
+ self.assertEqual(self._widget.render_hidden(request),
+ '<input type="hidden" name="field_foo" '
+ 'value="Foo Value" style="color: red" />')
+
+
+def test_suite():
+ loader = unittest.TestLoader()
+ return loader.loadTestsFromTestCase( Test )
+
+if __name__=='__main__':
+ unittest.TextTestRunner().run( test_suite() )
+
+
+
+
+
=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/tests/testTextWidget.py 1.1.4.1 => 1.1.4.2 ===
#
##############################################################################
-import unittest
-from Zope.App.Formulator import Errors
-
-
-class ContentObject:
- """Class to provide a stub for a field"""
-
- def getFoo(self):
- """ """
- return "Foo Value"
-
-
-class Field:
- """Field Stub """
-
- id = 'foo'
-
-
- def __init__(self, context):
- """ """
- self._context = context
-
-
- def getPropertyInContext(self):
- """ """
- return self._context.getFoo()
-
-
- def getValue(self, name):
- """ """
- return getattr(self, name, None)
-
-
-
-class Test(unittest.TestCase):
-
-
- def setUp(self):
-
- from Zope.App.Formulator.Widgets.Browser import TextWidget
- content = ContentObject()
- field = Field(content)
- self._widget = TextWidget.TextWidget(field)
-
-
- def testProperties(self):
-
- self.assertEqual(self._widget.getValue('extra'), '')
- self.assertEqual(self._widget.getValue('default'), '')
- self.assertEqual(self._widget.getValue('displayWidth'), 20)
- self.assertEqual(self._widget.getValue('displayMaxWidth'), '')
-
-
- def testRendering(self):
-
- request = {'field_foo': 'Foo Value'}
-
- self.assertNotEqual(self._widget.render(request), '')
-
- self.assertNotEqual(self._widget.render_hidden(request), '')
-
- self._widget.extra = '''style="color: red"'''
- self.assertNotEqual(self._widget.render_hidden(request), '')
-
-
-
-def test_suite():
- loader = unittest.TestLoader()
- return loader.loadTestsFromTestCase( Test )
-
-if __name__=='__main__':
- unittest.TextTestRunner().run( test_suite() )
-
-
-
-
-
+import unittest
+from Zope.App.Formulator import Errors
+
+
+class ContentObject:
+ """Class to provide a stub for a field"""
+
+ def getFoo(self):
+ """ """
+ return "Foo Value"
+
+
+class Field:
+ """Field Stub """
+
+ id = 'foo'
+
+
+ def __init__(self, context):
+ """ """
+ self._context = context
+
+
+ def getPropertyInContext(self):
+ """ """
+ return self._context.getFoo()
+
+
+ def getValue(self, name):
+ """ """
+ return getattr(self, name, None)
+
+
+
+class Test(unittest.TestCase):
+
+
+ def setUp(self):
+
+ from Zope.App.Formulator.Widgets.Browser import TextWidget
+ content = ContentObject()
+ field = Field(content)
+ self._widget = TextWidget.TextWidget(field)
+
+
+ def testProperties(self):
+
+ self.assertEqual(self._widget.getValue('extra'), '')
+ self.assertEqual(self._widget.getValue('default'), '')
+ self.assertEqual(self._widget.getValue('displayWidth'), 20)
+ self.assertEqual(self._widget.getValue('displayMaxWidth'), '')
+
+
+ def testRendering(self):
+
+ request = {'field_foo': 'Foo Value'}
+
+ self.assertNotEqual(self._widget.render(request), '')
+
+ self.assertNotEqual(self._widget.render_hidden(request), '')
+
+ self._widget.extra = '''style="color: red"'''
+ self.assertNotEqual(self._widget.render_hidden(request), '')
+
+
+
+def test_suite():
+ loader = unittest.TestLoader()
+ return loader.loadTestsFromTestCase( Test )
+
+if __name__=='__main__':
+ unittest.TextTestRunner().run( test_suite() )
+
+
+
+
+