Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/sqlite3/test/dump.py

    r2 r391  
    1414    def CheckTableDump(self):
    1515        expected_sqls = [
     16                """CREATE TABLE "index"("index" blob);"""
     17                ,
     18                """INSERT INTO "index" VALUES(X'01');"""
     19                ,
     20                """CREATE TABLE "quoted""table"("quoted""field" text);"""
     21                ,
     22                """INSERT INTO "quoted""table" VALUES('quoted''value');"""
     23                ,
    1624                "CREATE TABLE t1(id integer primary key, s1 text, " \
    1725                "t1_i1 integer not null, i2 integer, unique (s1), " \
     
    2129                ,
    2230                "INSERT INTO \"t1\" VALUES(2,'foo2',30,30);"
     31                ,
     32                u"INSERT INTO \"t1\" VALUES(3,'f\xc3\xb6',40,10);"
    2333                ,
    2434                "CREATE TABLE t2(id integer, t2_i1 integer, " \
     
    4252            for i in xrange(len(expected_sqls))]
    4353
     54    def CheckUnorderableRow(self):
     55        # iterdump() should be able to cope with unorderable row types (issue #15545)
     56        class UnorderableRow:
     57            def __init__(self, cursor, row):
     58                self.row = row
     59            def __getitem__(self, index):
     60                return self.row[index]
     61        self.cx.row_factory = UnorderableRow
     62        CREATE_ALPHA = """CREATE TABLE "alpha" ("one");"""
     63        CREATE_BETA = """CREATE TABLE "beta" ("two");"""
     64        expected = [
     65            "BEGIN TRANSACTION;",
     66            CREATE_ALPHA,
     67            CREATE_BETA,
     68            "COMMIT;"
     69            ]
     70        self.cu.execute(CREATE_BETA)
     71        self.cu.execute(CREATE_ALPHA)
     72        got = list(self.cx.iterdump())
     73        self.assertEqual(expected, got)
     74
    4475def suite():
    4576    return unittest.TestSuite(unittest.makeSuite(DumpTests, "Check"))
Note: See TracChangeset for help on using the changeset viewer.