From: Gerhard H?r. <gha...@us...> - 2002-07-29 01:00:06
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv32641/test Modified Files: PgSQLTestCases.py Log Message: 29JUL2002 gh Added a few tests for PgNumeric (which currently fail). Simplified the construction of testcases by a lot and fixed a bug where there were two methods named CheckConnectionObject (thus hiding the first one). Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PgSQLTestCases.py 1 Jul 2002 02:09:05 -0000 1.18 --- PgSQLTestCases.py 29 Jul 2002 00:59:59 -0000 1.19 *************** *** 33,36 **** --- 33,40 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 29JUL2002 gh Added a few tests for PgNumeric (which currently fail). | + # Simplified the construction of testcases by a lot and | + # fixed a bug where there were two methods named | + # CheckConnectionObject (thus hiding the first one). | # 16APR2002 gh Updated the PostgreSQL version specific tests to cope | # with PostgreSQL 7.2.x. | *************** *** 266,269 **** --- 270,280 ---- 'PgMoney __neg__ operation failed.') + def CheckPgNumeric(self): + a = PgSQL.PgNumeric('4634.00') + self.failUnless(a == 4634, 'PgNumeric comparison to Int failed.') + self.failUnless(a == 4634.0, 'PgNumeric comparison to Float failed.') + self.failUnless(a == 4634L, 'PgNumeric comparison to Long failed.') + self.failUnless(a != None, 'PgNumericcomparison to None failed') + class PgSQLTestCases(unittest.TestCase): def setUp(self): *************** *** 283,288 **** self.assert_(isinstance(self.cnx, PgSQL.Connection), 'PgSQL.connect did not return a Connection object') - - def CheckConnectionObject(self): self.assert_(self.cnx.autocommit == 0, 'autocommit default is not zero (0)') --- 294,297 ---- *************** *** 662,666 **** "res should be None at this point, but it isn't.") ! def MoreResultObjectChecks(self): # Define the row counts for various version of PosrtgreSQL # Note: We only have to check for the minor version number in order --- 671,675 ---- "res should be None at this point, but it isn't.") ! def CheckDoMoreResultObjectChecks(self): # Define the row counts for various version of PosrtgreSQL # Note: We only have to check for the minor version number in order *************** *** 707,772 **** self.fail(msg) ! def main(): ! TestSuite = unittest.TestSuite() ! TestSuite.addTest(DBAPICompliance("CheckAPILevel")) ! TestSuite.addTest(DBAPICompliance("CheckThreadSafety")) ! TestSuite.addTest(DBAPICompliance("CheckParamStyle")) ! TestSuite.addTest(DBAPICompliance("CheckWarning")) ! TestSuite.addTest(DBAPICompliance("CheckError")) ! TestSuite.addTest(DBAPICompliance("CheckInterfaceError")) ! TestSuite.addTest(DBAPICompliance("CheckDatabaseError")) ! TestSuite.addTest(DBAPICompliance("CheckDataError")) ! TestSuite.addTest(DBAPICompliance("CheckOperationalError")) ! TestSuite.addTest(DBAPICompliance("CheckIntegrityError")) ! TestSuite.addTest(DBAPICompliance("CheckInternalError")) ! TestSuite.addTest(DBAPICompliance("CheckProgrammingError")) ! TestSuite.addTest(DBAPICompliance("CheckNotSupportedError")) ! ! TestSuite.addTest(PgSQLTestModuleInterface("CheckFetchReturnsList")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckBooleanConstructors")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckPgInt8")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckPgInt2")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckPgMoney")) ! ! TestSuite.addTest(PgSQLTestCases("CheckConnectionObject")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionObject")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionObject")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionClose")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionCommit")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionRollback")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionCursor")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionBinary")) ! TestSuite.addTest(PgSQLTestCases("CheckCloseConnection")) ! if version >= 20100: ! TestSuite.addTest(PgSQLTestCases("CheckWeakReference1")) ! TestSuite.addTest(PgSQLTestCases("CheckWeakReference2")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorObject")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorArraysize")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorDescription")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorRowcount")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorCallproc")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorClose")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorExecute")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorExecutemany")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorFetchone")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorFetchMany")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorFetchall")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorSetoutputsize")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorSetinputsizes")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorNextset")) ! TestSuite.addTest(PgSQLTestCases("CheckPgVer")) ! TestSuite.addTest(PgSQLTestCases("CheckExecuteWithSingleton")) ! TestSuite.addTest(PgSQLTestCases("CheckExecuteWithTuple")) ! TestSuite.addTest(PgSQLTestCases("CheckExecuteWithDictionary")) ! TestSuite.addTest(PgSQLTestCases("CheckResultObject")) ! TestSuite.addTest(PgSQLTestCases("CheckResultFetchone")) ! TestSuite.addTest(PgSQLTestCases("MoreResultObjectChecks")) ! TestSuite.addTest(PgSQLTestCases("CheckSelectOfNonPrintableString")) runner = unittest.TextTestRunner() ! runner.run(TestSuite) if __name__ == "__main__": main() - --- 716,732 ---- self.fail(msg) ! def suite(): ! dbapi_tests = unittest.makeSuite(DBAPICompliance, "Check") ! moduleinterface_tests = unittest.makeSuite(PgSQLTestModuleInterface, "Check") ! pgsql_tests = unittest.makeSuite(PgSQLTestCases, "Check") ! test_suite = unittest.TestSuite((dbapi_tests, moduleinterface_tests, ! pgsql_tests)) ! return test_suite + def main(): runner = unittest.TextTestRunner() ! runner.run(suite()) if __name__ == "__main__": main() |