| 1 | n/a | #-*- coding: iso-8859-1 -*- |
|---|
| 2 | n/a | # pysqlite2/test/regression.py: pysqlite regression tests |
|---|
| 3 | n/a | # |
|---|
| 4 | n/a | # Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de> |
|---|
| 5 | n/a | # |
|---|
| 6 | n/a | # This file is part of pysqlite. |
|---|
| 7 | n/a | # |
|---|
| 8 | n/a | # This software is provided 'as-is', without any express or implied |
|---|
| 9 | n/a | # warranty. In no event will the authors be held liable for any damages |
|---|
| 10 | n/a | # arising from the use of this software. |
|---|
| 11 | n/a | # |
|---|
| 12 | n/a | # Permission is granted to anyone to use this software for any purpose, |
|---|
| 13 | n/a | # including commercial applications, and to alter it and redistribute it |
|---|
| 14 | n/a | # freely, subject to the following restrictions: |
|---|
| 15 | n/a | # |
|---|
| 16 | n/a | # 1. The origin of this software must not be misrepresented; you must not |
|---|
| 17 | n/a | # claim that you wrote the original software. If you use this software |
|---|
| 18 | n/a | # in a product, an acknowledgment in the product documentation would be |
|---|
| 19 | n/a | # appreciated but is not required. |
|---|
| 20 | n/a | # 2. Altered source versions must be plainly marked as such, and must not be |
|---|
| 21 | n/a | # misrepresented as being the original software. |
|---|
| 22 | n/a | # 3. This notice may not be removed or altered from any source distribution. |
|---|
| 23 | n/a | |
|---|
| 24 | n/a | import datetime |
|---|
| 25 | n/a | import unittest |
|---|
| 26 | n/a | import sqlite3 as sqlite |
|---|
| 27 | n/a | |
|---|
| 28 | n/a | class RegressionTests(unittest.TestCase): |
|---|
| 29 | n/a | def setUp(self): |
|---|
| 30 | n/a | self.con = sqlite.connect(":memory:") |
|---|
| 31 | n/a | |
|---|
| 32 | n/a | def tearDown(self): |
|---|
| 33 | n/a | self.con.close() |
|---|
| 34 | n/a | |
|---|
| 35 | n/a | def CheckPragmaUserVersion(self): |
|---|
| 36 | n/a | # This used to crash pysqlite because this pragma command returns NULL for the column name |
|---|
| 37 | n/a | cur = self.con.cursor() |
|---|
| 38 | n/a | cur.execute("pragma user_version") |
|---|
| 39 | n/a | |
|---|
| 40 | n/a | def CheckPragmaSchemaVersion(self): |
|---|
| 41 | n/a | # This still crashed pysqlite <= 2.2.1 |
|---|
| 42 | n/a | con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) |
|---|
| 43 | n/a | try: |
|---|
| 44 | n/a | cur = self.con.cursor() |
|---|
| 45 | n/a | cur.execute("pragma schema_version") |
|---|
| 46 | n/a | finally: |
|---|
| 47 | n/a | cur.close() |
|---|
| 48 | n/a | con.close() |
|---|
| 49 | n/a | |
|---|
| 50 | n/a | def CheckStatementReset(self): |
|---|
| 51 | n/a | # pysqlite 2.1.0 to 2.2.0 have the problem that not all statements are |
|---|
| 52 | n/a | # reset before a rollback, but only those that are still in the |
|---|
| 53 | n/a | # statement cache. The others are not accessible from the connection object. |
|---|
| 54 | n/a | con = sqlite.connect(":memory:", cached_statements=5) |
|---|
| 55 | n/a | cursors = [con.cursor() for x in range(5)] |
|---|
| 56 | n/a | cursors[0].execute("create table test(x)") |
|---|
| 57 | n/a | for i in range(10): |
|---|
| 58 | n/a | cursors[0].executemany("insert into test(x) values (?)", [(x,) for x in range(10)]) |
|---|
| 59 | n/a | |
|---|
| 60 | n/a | for i in range(5): |
|---|
| 61 | n/a | cursors[i].execute(" " * i + "select x from test") |
|---|
| 62 | n/a | |
|---|
| 63 | n/a | con.rollback() |
|---|
| 64 | n/a | |
|---|
| 65 | n/a | def CheckColumnNameWithSpaces(self): |
|---|
| 66 | n/a | cur = self.con.cursor() |
|---|
| 67 | n/a | cur.execute('select 1 as "foo bar [datetime]"') |
|---|
| 68 | n/a | self.assertEqual(cur.description[0][0], "foo bar") |
|---|
| 69 | n/a | |
|---|
| 70 | n/a | cur.execute('select 1 as "foo baz"') |
|---|
| 71 | n/a | self.assertEqual(cur.description[0][0], "foo baz") |
|---|
| 72 | n/a | |
|---|
| 73 | n/a | def CheckStatementFinalizationOnCloseDb(self): |
|---|
| 74 | n/a | # pysqlite versions <= 2.3.3 only finalized statements in the statement |
|---|
| 75 | n/a | # cache when closing the database. statements that were still |
|---|
| 76 | n/a | # referenced in cursors weren't closed and could provoke " |
|---|
| 77 | n/a | # "OperationalError: Unable to close due to unfinalised statements". |
|---|
| 78 | n/a | con = sqlite.connect(":memory:") |
|---|
| 79 | n/a | cursors = [] |
|---|
| 80 | n/a | # default statement cache size is 100 |
|---|
| 81 | n/a | for i in range(105): |
|---|
| 82 | n/a | cur = con.cursor() |
|---|
| 83 | n/a | cursors.append(cur) |
|---|
| 84 | n/a | cur.execute("select 1 x union select " + str(i)) |
|---|
| 85 | n/a | con.close() |
|---|
| 86 | n/a | |
|---|
| 87 | n/a | @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), 'needs sqlite 3.2.2 or newer') |
|---|
| 88 | n/a | def CheckOnConflictRollback(self): |
|---|
| 89 | n/a | con = sqlite.connect(":memory:") |
|---|
| 90 | n/a | con.execute("create table foo(x, unique(x) on conflict rollback)") |
|---|
| 91 | n/a | con.execute("insert into foo(x) values (1)") |
|---|
| 92 | n/a | try: |
|---|
| 93 | n/a | con.execute("insert into foo(x) values (1)") |
|---|
| 94 | n/a | except sqlite.DatabaseError: |
|---|
| 95 | n/a | pass |
|---|
| 96 | n/a | con.execute("insert into foo(x) values (2)") |
|---|
| 97 | n/a | try: |
|---|
| 98 | n/a | con.commit() |
|---|
| 99 | n/a | except sqlite.OperationalError: |
|---|
| 100 | n/a | self.fail("pysqlite knew nothing about the implicit ROLLBACK") |
|---|
| 101 | n/a | |
|---|
| 102 | n/a | def CheckWorkaroundForBuggySqliteTransferBindings(self): |
|---|
| 103 | n/a | """ |
|---|
| 104 | n/a | pysqlite would crash with older SQLite versions unless |
|---|
| 105 | n/a | a workaround is implemented. |
|---|
| 106 | n/a | """ |
|---|
| 107 | n/a | self.con.execute("create table foo(bar)") |
|---|
| 108 | n/a | self.con.execute("drop table foo") |
|---|
| 109 | n/a | self.con.execute("create table foo(bar)") |
|---|
| 110 | n/a | |
|---|
| 111 | n/a | def CheckEmptyStatement(self): |
|---|
| 112 | n/a | """ |
|---|
| 113 | n/a | pysqlite used to segfault with SQLite versions 3.5.x. These return NULL |
|---|
| 114 | n/a | for "no-operation" statements |
|---|
| 115 | n/a | """ |
|---|
| 116 | n/a | self.con.execute("") |
|---|
| 117 | n/a | |
|---|
| 118 | n/a | def CheckTypeMapUsage(self): |
|---|
| 119 | n/a | """ |
|---|
| 120 | n/a | pysqlite until 2.4.1 did not rebuild the row_cast_map when recompiling |
|---|
| 121 | n/a | a statement. This test exhibits the problem. |
|---|
| 122 | n/a | """ |
|---|
| 123 | n/a | SELECT = "select * from foo" |
|---|
| 124 | n/a | con = sqlite.connect(":memory:",detect_types=sqlite.PARSE_DECLTYPES) |
|---|
| 125 | n/a | con.execute("create table foo(bar timestamp)") |
|---|
| 126 | n/a | con.execute("insert into foo(bar) values (?)", (datetime.datetime.now(),)) |
|---|
| 127 | n/a | con.execute(SELECT) |
|---|
| 128 | n/a | con.execute("drop table foo") |
|---|
| 129 | n/a | con.execute("create table foo(bar integer)") |
|---|
| 130 | n/a | con.execute("insert into foo(bar) values (5)") |
|---|
| 131 | n/a | con.execute(SELECT) |
|---|
| 132 | n/a | |
|---|
| 133 | n/a | def CheckErrorMsgDecodeError(self): |
|---|
| 134 | n/a | # When porting the module to Python 3.0, the error message about |
|---|
| 135 | n/a | # decoding errors disappeared. This verifies they're back again. |
|---|
| 136 | n/a | with self.assertRaises(sqlite.OperationalError) as cm: |
|---|
| 137 | n/a | self.con.execute("select 'xxx' || ? || 'yyy' colname", |
|---|
| 138 | n/a | (bytes(bytearray([250])),)).fetchone() |
|---|
| 139 | n/a | msg = "Could not decode to UTF-8 column 'colname' with text 'xxx" |
|---|
| 140 | n/a | self.assertIn(msg, str(cm.exception)) |
|---|
| 141 | n/a | |
|---|
| 142 | n/a | def CheckRegisterAdapter(self): |
|---|
| 143 | n/a | """ |
|---|
| 144 | n/a | See issue 3312. |
|---|
| 145 | n/a | """ |
|---|
| 146 | n/a | self.assertRaises(TypeError, sqlite.register_adapter, {}, None) |
|---|
| 147 | n/a | |
|---|
| 148 | n/a | def CheckSetIsolationLevel(self): |
|---|
| 149 | n/a | # See issue 27881. |
|---|
| 150 | n/a | class CustomStr(str): |
|---|
| 151 | n/a | def upper(self): |
|---|
| 152 | n/a | return None |
|---|
| 153 | n/a | def __del__(self): |
|---|
| 154 | n/a | con.isolation_level = "" |
|---|
| 155 | n/a | |
|---|
| 156 | n/a | con = sqlite.connect(":memory:") |
|---|
| 157 | n/a | con.isolation_level = None |
|---|
| 158 | n/a | for level in "", "DEFERRED", "IMMEDIATE", "EXCLUSIVE": |
|---|
| 159 | n/a | with self.subTest(level=level): |
|---|
| 160 | n/a | con.isolation_level = level |
|---|
| 161 | n/a | con.isolation_level = level.lower() |
|---|
| 162 | n/a | con.isolation_level = level.capitalize() |
|---|
| 163 | n/a | con.isolation_level = CustomStr(level) |
|---|
| 164 | n/a | |
|---|
| 165 | n/a | # setting isolation_level failure should not alter previous state |
|---|
| 166 | n/a | con.isolation_level = None |
|---|
| 167 | n/a | con.isolation_level = "DEFERRED" |
|---|
| 168 | n/a | pairs = [ |
|---|
| 169 | n/a | (1, TypeError), (b'', TypeError), ("abc", ValueError), |
|---|
| 170 | n/a | ("IMMEDIATE\0EXCLUSIVE", ValueError), ("\xe9", ValueError), |
|---|
| 171 | n/a | ] |
|---|
| 172 | n/a | for value, exc in pairs: |
|---|
| 173 | n/a | with self.subTest(level=value): |
|---|
| 174 | n/a | with self.assertRaises(exc): |
|---|
| 175 | n/a | con.isolation_level = value |
|---|
| 176 | n/a | self.assertEqual(con.isolation_level, "DEFERRED") |
|---|
| 177 | n/a | |
|---|
| 178 | n/a | def CheckCursorConstructorCallCheck(self): |
|---|
| 179 | n/a | """ |
|---|
| 180 | n/a | Verifies that cursor methods check whether base class __init__ was |
|---|
| 181 | n/a | called. |
|---|
| 182 | n/a | """ |
|---|
| 183 | n/a | class Cursor(sqlite.Cursor): |
|---|
| 184 | n/a | def __init__(self, con): |
|---|
| 185 | n/a | pass |
|---|
| 186 | n/a | |
|---|
| 187 | n/a | con = sqlite.connect(":memory:") |
|---|
| 188 | n/a | cur = Cursor(con) |
|---|
| 189 | n/a | with self.assertRaises(sqlite.ProgrammingError): |
|---|
| 190 | n/a | cur.execute("select 4+5").fetchall() |
|---|
| 191 | n/a | |
|---|
| 192 | n/a | def CheckStrSubclass(self): |
|---|
| 193 | n/a | """ |
|---|
| 194 | n/a | The Python 3.0 port of the module didn't cope with values of subclasses of str. |
|---|
| 195 | n/a | """ |
|---|
| 196 | n/a | class MyStr(str): pass |
|---|
| 197 | n/a | self.con.execute("select ?", (MyStr("abc"),)) |
|---|
| 198 | n/a | |
|---|
| 199 | n/a | def CheckConnectionConstructorCallCheck(self): |
|---|
| 200 | n/a | """ |
|---|
| 201 | n/a | Verifies that connection methods check whether base class __init__ was |
|---|
| 202 | n/a | called. |
|---|
| 203 | n/a | """ |
|---|
| 204 | n/a | class Connection(sqlite.Connection): |
|---|
| 205 | n/a | def __init__(self, name): |
|---|
| 206 | n/a | pass |
|---|
| 207 | n/a | |
|---|
| 208 | n/a | con = Connection(":memory:") |
|---|
| 209 | n/a | with self.assertRaises(sqlite.ProgrammingError): |
|---|
| 210 | n/a | cur = con.cursor() |
|---|
| 211 | n/a | |
|---|
| 212 | n/a | def CheckCursorRegistration(self): |
|---|
| 213 | n/a | """ |
|---|
| 214 | n/a | Verifies that subclassed cursor classes are correctly registered with |
|---|
| 215 | n/a | the connection object, too. (fetch-across-rollback problem) |
|---|
| 216 | n/a | """ |
|---|
| 217 | n/a | class Connection(sqlite.Connection): |
|---|
| 218 | n/a | def cursor(self): |
|---|
| 219 | n/a | return Cursor(self) |
|---|
| 220 | n/a | |
|---|
| 221 | n/a | class Cursor(sqlite.Cursor): |
|---|
| 222 | n/a | def __init__(self, con): |
|---|
| 223 | n/a | sqlite.Cursor.__init__(self, con) |
|---|
| 224 | n/a | |
|---|
| 225 | n/a | con = Connection(":memory:") |
|---|
| 226 | n/a | cur = con.cursor() |
|---|
| 227 | n/a | cur.execute("create table foo(x)") |
|---|
| 228 | n/a | cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) |
|---|
| 229 | n/a | cur.execute("select x from foo") |
|---|
| 230 | n/a | con.rollback() |
|---|
| 231 | n/a | with self.assertRaises(sqlite.InterfaceError): |
|---|
| 232 | n/a | cur.fetchall() |
|---|
| 233 | n/a | |
|---|
| 234 | n/a | def CheckAutoCommit(self): |
|---|
| 235 | n/a | """ |
|---|
| 236 | n/a | Verifies that creating a connection in autocommit mode works. |
|---|
| 237 | n/a | 2.5.3 introduced a regression so that these could no longer |
|---|
| 238 | n/a | be created. |
|---|
| 239 | n/a | """ |
|---|
| 240 | n/a | con = sqlite.connect(":memory:", isolation_level=None) |
|---|
| 241 | n/a | |
|---|
| 242 | n/a | def CheckPragmaAutocommit(self): |
|---|
| 243 | n/a | """ |
|---|
| 244 | n/a | Verifies that running a PRAGMA statement that does an autocommit does |
|---|
| 245 | n/a | work. This did not work in 2.5.3/2.5.4. |
|---|
| 246 | n/a | """ |
|---|
| 247 | n/a | cur = self.con.cursor() |
|---|
| 248 | n/a | cur.execute("create table foo(bar)") |
|---|
| 249 | n/a | cur.execute("insert into foo(bar) values (5)") |
|---|
| 250 | n/a | |
|---|
| 251 | n/a | cur.execute("pragma page_size") |
|---|
| 252 | n/a | row = cur.fetchone() |
|---|
| 253 | n/a | |
|---|
| 254 | n/a | def CheckSetDict(self): |
|---|
| 255 | n/a | """ |
|---|
| 256 | n/a | See http://bugs.python.org/issue7478 |
|---|
| 257 | n/a | |
|---|
| 258 | n/a | It was possible to successfully register callbacks that could not be |
|---|
| 259 | n/a | hashed. Return codes of PyDict_SetItem were not checked properly. |
|---|
| 260 | n/a | """ |
|---|
| 261 | n/a | class NotHashable: |
|---|
| 262 | n/a | def __call__(self, *args, **kw): |
|---|
| 263 | n/a | pass |
|---|
| 264 | n/a | def __hash__(self): |
|---|
| 265 | n/a | raise TypeError() |
|---|
| 266 | n/a | var = NotHashable() |
|---|
| 267 | n/a | self.assertRaises(TypeError, self.con.create_function, var) |
|---|
| 268 | n/a | self.assertRaises(TypeError, self.con.create_aggregate, var) |
|---|
| 269 | n/a | self.assertRaises(TypeError, self.con.set_authorizer, var) |
|---|
| 270 | n/a | self.assertRaises(TypeError, self.con.set_progress_handler, var) |
|---|
| 271 | n/a | |
|---|
| 272 | n/a | def CheckConnectionCall(self): |
|---|
| 273 | n/a | """ |
|---|
| 274 | n/a | Call a connection with a non-string SQL request: check error handling |
|---|
| 275 | n/a | of the statement constructor. |
|---|
| 276 | n/a | """ |
|---|
| 277 | n/a | self.assertRaises(sqlite.Warning, self.con, 1) |
|---|
| 278 | n/a | |
|---|
| 279 | n/a | def CheckCollation(self): |
|---|
| 280 | n/a | def collation_cb(a, b): |
|---|
| 281 | n/a | return 1 |
|---|
| 282 | n/a | self.assertRaises(sqlite.ProgrammingError, self.con.create_collation, |
|---|
| 283 | n/a | # Lone surrogate cannot be encoded to the default encoding (utf8) |
|---|
| 284 | n/a | "\uDC80", collation_cb) |
|---|
| 285 | n/a | |
|---|
| 286 | n/a | def CheckRecursiveCursorUse(self): |
|---|
| 287 | n/a | """ |
|---|
| 288 | n/a | http://bugs.python.org/issue10811 |
|---|
| 289 | n/a | |
|---|
| 290 | n/a | Recursively using a cursor, such as when reusing it from a generator led to segfaults. |
|---|
| 291 | n/a | Now we catch recursive cursor usage and raise a ProgrammingError. |
|---|
| 292 | n/a | """ |
|---|
| 293 | n/a | con = sqlite.connect(":memory:") |
|---|
| 294 | n/a | |
|---|
| 295 | n/a | cur = con.cursor() |
|---|
| 296 | n/a | cur.execute("create table a (bar)") |
|---|
| 297 | n/a | cur.execute("create table b (baz)") |
|---|
| 298 | n/a | |
|---|
| 299 | n/a | def foo(): |
|---|
| 300 | n/a | cur.execute("insert into a (bar) values (?)", (1,)) |
|---|
| 301 | n/a | yield 1 |
|---|
| 302 | n/a | |
|---|
| 303 | n/a | with self.assertRaises(sqlite.ProgrammingError): |
|---|
| 304 | n/a | cur.executemany("insert into b (baz) values (?)", |
|---|
| 305 | n/a | ((i,) for i in foo())) |
|---|
| 306 | n/a | |
|---|
| 307 | n/a | def CheckConvertTimestampMicrosecondPadding(self): |
|---|
| 308 | n/a | """ |
|---|
| 309 | n/a | http://bugs.python.org/issue14720 |
|---|
| 310 | n/a | |
|---|
| 311 | n/a | The microsecond parsing of convert_timestamp() should pad with zeros, |
|---|
| 312 | n/a | since the microsecond string "456" actually represents "456000". |
|---|
| 313 | n/a | """ |
|---|
| 314 | n/a | |
|---|
| 315 | n/a | con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES) |
|---|
| 316 | n/a | cur = con.cursor() |
|---|
| 317 | n/a | cur.execute("CREATE TABLE t (x TIMESTAMP)") |
|---|
| 318 | n/a | |
|---|
| 319 | n/a | # Microseconds should be 456000 |
|---|
| 320 | n/a | cur.execute("INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.456')") |
|---|
| 321 | n/a | |
|---|
| 322 | n/a | # Microseconds should be truncated to 123456 |
|---|
| 323 | n/a | cur.execute("INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.123456789')") |
|---|
| 324 | n/a | |
|---|
| 325 | n/a | cur.execute("SELECT * FROM t") |
|---|
| 326 | n/a | values = [x[0] for x in cur.fetchall()] |
|---|
| 327 | n/a | |
|---|
| 328 | n/a | self.assertEqual(values, [ |
|---|
| 329 | n/a | datetime.datetime(2012, 4, 4, 15, 6, 0, 456000), |
|---|
| 330 | n/a | datetime.datetime(2012, 4, 4, 15, 6, 0, 123456), |
|---|
| 331 | n/a | ]) |
|---|
| 332 | n/a | |
|---|
| 333 | n/a | def CheckInvalidIsolationLevelType(self): |
|---|
| 334 | n/a | # isolation level is a string, not an integer |
|---|
| 335 | n/a | self.assertRaises(TypeError, |
|---|
| 336 | n/a | sqlite.connect, ":memory:", isolation_level=123) |
|---|
| 337 | n/a | |
|---|
| 338 | n/a | |
|---|
| 339 | n/a | def CheckNullCharacter(self): |
|---|
| 340 | n/a | # Issue #21147 |
|---|
| 341 | n/a | con = sqlite.connect(":memory:") |
|---|
| 342 | n/a | self.assertRaises(ValueError, con, "\0select 1") |
|---|
| 343 | n/a | self.assertRaises(ValueError, con, "select 1\0") |
|---|
| 344 | n/a | cur = con.cursor() |
|---|
| 345 | n/a | self.assertRaises(ValueError, cur.execute, " \0select 2") |
|---|
| 346 | n/a | self.assertRaises(ValueError, cur.execute, "select 2\0") |
|---|
| 347 | n/a | |
|---|
| 348 | n/a | def CheckCommitCursorReset(self): |
|---|
| 349 | n/a | """ |
|---|
| 350 | n/a | Connection.commit() did reset cursors, which made sqlite3 |
|---|
| 351 | n/a | to return rows multiple times when fetched from cursors |
|---|
| 352 | n/a | after commit. See issues 10513 and 23129 for details. |
|---|
| 353 | n/a | """ |
|---|
| 354 | n/a | con = sqlite.connect(":memory:") |
|---|
| 355 | n/a | con.executescript(""" |
|---|
| 356 | n/a | create table t(c); |
|---|
| 357 | n/a | create table t2(c); |
|---|
| 358 | n/a | insert into t values(0); |
|---|
| 359 | n/a | insert into t values(1); |
|---|
| 360 | n/a | insert into t values(2); |
|---|
| 361 | n/a | """) |
|---|
| 362 | n/a | |
|---|
| 363 | n/a | self.assertEqual(con.isolation_level, "") |
|---|
| 364 | n/a | |
|---|
| 365 | n/a | counter = 0 |
|---|
| 366 | n/a | for i, row in enumerate(con.execute("select c from t")): |
|---|
| 367 | n/a | with self.subTest(i=i, row=row): |
|---|
| 368 | n/a | con.execute("insert into t2(c) values (?)", (i,)) |
|---|
| 369 | n/a | con.commit() |
|---|
| 370 | n/a | if counter == 0: |
|---|
| 371 | n/a | self.assertEqual(row[0], 0) |
|---|
| 372 | n/a | elif counter == 1: |
|---|
| 373 | n/a | self.assertEqual(row[0], 1) |
|---|
| 374 | n/a | elif counter == 2: |
|---|
| 375 | n/a | self.assertEqual(row[0], 2) |
|---|
| 376 | n/a | counter += 1 |
|---|
| 377 | n/a | self.assertEqual(counter, 3, "should have returned exactly three rows") |
|---|
| 378 | n/a | |
|---|
| 379 | n/a | |
|---|
| 380 | n/a | def suite(): |
|---|
| 381 | n/a | regression_suite = unittest.makeSuite(RegressionTests, "Check") |
|---|
| 382 | n/a | return unittest.TestSuite((regression_suite,)) |
|---|
| 383 | n/a | |
|---|
| 384 | n/a | def test(): |
|---|
| 385 | n/a | runner = unittest.TextTestRunner() |
|---|
| 386 | n/a | runner.run(suite()) |
|---|
| 387 | n/a | |
|---|
| 388 | n/a | if __name__ == "__main__": |
|---|
| 389 | n/a | test() |
|---|