[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_sqlscript.py:1.1.2.3

Fred L. Drake, Jr. fred@zope.com
Tue, 24 Dec 2002 10:12:25 -0500


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

Modified Files:
      Tag: NameGeddon-branch
	test_sqlscript.py 
Log Message:
minor cleanups


=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/content/tests/test_sqlscript.py:1.1.2.2	Tue Dec 24 07:51:00 2002
+++ Zope3/src/zope/app/content/tests/test_sqlscript.py	Tue Dec 24 10:12:24 2002
@@ -7,7 +7,7 @@
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """DT_SQLVar Tests
@@ -22,13 +22,11 @@
 from zope.app.interfaces.rdb import IZopeCursor
 from zope.component import getService
 from zope.app.component import nextservice
+from zope.component.service import serviceManager as sm
 from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.service import \
-     serviceManager as sm
 
-from zope.app.content.sql import SQLScript
+from zope.app.content.sql import SQLScript, Arguments
 from zope.app.interfaces.content.sql import ISQLScript
-from zope.app.content.sql import Arguments
 
 from zope.app.interfaces.annotation import IAnnotatable
 from zope.app.interfaces.annotation import IAnnotations
@@ -38,7 +36,9 @@
 from zope.app.interfaces.cache.cache import ICacheable
 from zope.app.interfaces.cache.cache import ICachingService
 from zope.app.cache.annotationcacheable import AnnotationCacheable
-from zope.app.interfaces.traversing.physicallylocatable import IPhysicallyLocatable
+from zope.app.interfaces.traversing.physicallylocatable \
+     import IPhysicallyLocatable
+
 
 # Make spme fixes, so that we overcome some of the natural ZODB properties
 def getNextServiceManager(context):
@@ -149,50 +149,44 @@
 
     def _getScript(self):
         return SQLScript("my_connection",
-                   "SELECT name, counter FROM Table WHERE <dtml-sqltest id type=int>",
+                         "SELECT name, counter FROM Table WHERE"
+                         " <dtml-sqltest id type=int>",
                          'id')
 
-
     def testGetArguments(self):
         assert isinstance(arguments, StringTypes), \
                '"arguments" argument of setArguments() must be a string'
         self._arg_string = arguments
         self.arguments = parseArguments(arguments)
 
-
     def testGetArguments(self):
         result = Arguments({'id': {}})
         args = self._getScript().getArguments()
         self.assertEqual(args, result)
 
-
     def testGetArgumentsString(self):
         self.assertEqual('id', self._getScript().getArgumentsString())
 
-
     def testSetSource(self):
         script = self._getScript()
         script.setSource('SELECT * FROM Table')
         self.assertEqual('SELECT * FROM Table', script.getSource())
 
-
     def testGetSource(self):
-        self.assertEqual(
-            "SELECT name, counter FROM Table WHERE <dtml-sqltest id type=int>",
-            self._getScript().getSource())
-
+        expected = ("SELECT name, counter FROM Table"
+                    " WHERE <dtml-sqltest id type=int>")
+        self.assertEqual(expected,
+                         self._getScript().getSource())
 
     def testSetConnectionName(self):
         script = self._getScript()
         script.setConnectionName('test_conn')
         self.assertEqual('test_conn', script.getConnectionName())
 
-
     def testGetConnectionName(self):
         self.assertEqual('my_connection',
                          self._getScript().getConnectionName())
 
-
     def testSQLScript(self):
         result = self._getScript()(id=1)
         self.assertEqual(result.columns, ('name','counter'))
@@ -218,9 +212,7 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(SQLScriptTest))
-    return suite
+    return unittest.makeSuite(SQLScriptTest)
 
 if __name__ == '__main__':
-    unittest.TextTestRunner().run(test_suite())
+    unittest.main(defaultTest='test_suite')