test dict escaping
(self)
| 96 | c.execute("drop table test_datatypes") |
| 97 | |
| 98 | def test_dict(self): |
| 99 | """test dict escaping""" |
| 100 | conn = self.connect() |
| 101 | c = conn.cursor() |
| 102 | c.execute("create table test_dict (a integer, b integer, c integer)") |
| 103 | try: |
| 104 | c.execute( |
| 105 | "insert into test_dict (a,b,c) values (%(a)s, %(b)s, %(c)s)", |
| 106 | {"a": 1, "b": 2, "c": 3}, |
| 107 | ) |
| 108 | c.execute("select a,b,c from test_dict") |
| 109 | self.assertEqual((1, 2, 3), c.fetchone()) |
| 110 | finally: |
| 111 | c.execute("drop table test_dict") |
| 112 | |
| 113 | def test_string(self): |
| 114 | conn = self.connect() |