test aggregate functions
(self)
| 269 | c.execute("drop table test_nr") |
| 270 | |
| 271 | def test_aggregates(self): |
| 272 | """test aggregate functions""" |
| 273 | conn = self.connect() |
| 274 | c = conn.cursor() |
| 275 | try: |
| 276 | c.execute("create table test_aggregates (i integer)") |
| 277 | for i in range(10): |
| 278 | c.execute("insert into test_aggregates (i) values (%s)", (i,)) |
| 279 | c.execute("select sum(i) from test_aggregates") |
| 280 | (r,) = c.fetchone() |
| 281 | self.assertEqual(sum(range(10)), r) |
| 282 | finally: |
| 283 | c.execute("drop table test_aggregates") |
| 284 | |
| 285 | def test_single_tuple(self): |
| 286 | """test a single tuple""" |