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/hooks.py

    r2 r391  
    3838            self.fail("should have raised a TypeError")
    3939        except TypeError, e:
    40             self.failUnlessEqual(e.args[0], "parameter must be callable")
     40            self.assertEqual(e.args[0], "parameter must be callable")
    4141
    4242    def CheckCreateCollationNotAscii(self):
     
    7575            self.fail("should have raised an OperationalError")
    7676        except sqlite.OperationalError, e:
    77             self.failUnlessEqual(e.args[0].lower(), "no such collation sequence: mycoll")
     77            self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll")
     78
     79    def CheckCollationReturnsLargeInteger(self):
     80        def mycoll(x, y):
     81            # reverse order
     82            return -((x > y) - (x < y)) * 2**32
     83        con = sqlite.connect(":memory:")
     84        con.create_collation("mycoll", mycoll)
     85        sql = """
     86            select x from (
     87            select 'a' as x
     88            union
     89            select 'b' as x
     90            union
     91            select 'c' as x
     92            ) order by x collate mycoll
     93            """
     94        result = con.execute(sql).fetchall()
     95        self.assertEqual(result, [('c',), ('b',), ('a',)],
     96                         msg="the expected order was not returned")
    7897
    7998    def CheckCollationRegisterTwice(self):
     
    120139            create table foo(a, b)
    121140            """)
    122         self.failUnless(progress_calls)
     141        self.assertTrue(progress_calls)
    123142
    124143
     
    144163            """)
    145164        second_count = len(progress_calls)
    146         self.failUnless(first_count > second_count)
     165        self.assertTrue(first_count > second_count)
    147166
    148167    def CheckCancelOperation(self):
     
    167186        """
    168187        con = sqlite.connect(":memory:")
    169         action = 0
    170         def progress():
    171             action = 1
     188        action = []
     189        def progress():
     190            action.append(1)
    172191            return 0
    173192        con.set_progress_handler(progress, 1)
    174193        con.set_progress_handler(None, 1)
    175194        con.execute("select 1 union select 2 union select 3").fetchall()
    176         self.failUnlessEqual(action, 0, "progress handler was not cleared")
     195        self.assertEqual(len(action), 0, "progress handler was not cleared")
    177196
    178197def suite():
Note: See TracChangeset for help on using the changeset viewer.