MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / test_aggregates

Method test_aggregates

pymysql/tests/test_basic.py:271–283  ·  view source on GitHub ↗

test aggregate functions

(self)

Source from the content-addressed store, hash-verified

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"""

Callers

nothing calls this directly

Calls 4

cursorMethod · 0.80
executeMethod · 0.80
connectMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected