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