MCPcopy
hub / github.com/PyMySQL/PyMySQL / setUp

Method setUp

pymysql/tests/test_DictCursor.py:15–34  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

13 cursor_type = pymysql.cursors.DictCursor
14
15 def setUp(self):
16 super().setUp()
17 self.conn = conn = self.connect()
18 c = conn.cursor(self.cursor_type)
19
20 # create a table and some data to query
21 with warnings.catch_warnings():
22 warnings.filterwarnings("ignore")
23 c.execute("drop table if exists dictcursor")
24 # include in filterwarnings since for unbuffered dict cursor warning for lack of table
25 # will only be propagated at start of next execute() call
26 c.execute(
27 """CREATE TABLE dictcursor (name char(20), age int , DOB datetime)"""
28 )
29 data = [
30 ("bob", 21, "1990-02-06 23:04:56"),
31 ("jim", 56, "1955-05-09 13:12:45"),
32 ("fred", 100, "1911-09-12 01:01:01"),
33 ]
34 c.executemany("insert into dictcursor values (%s,%s,%s)", data)
35
36 def tearDown(self):
37 c = self.conn.cursor()

Callers

nothing calls this directly

Calls 4

cursorMethod · 0.80
executeMethod · 0.80
executemanyMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected