| 134 | |
| 135 | |
| 136 | def test_binary_cursor_text_override(conn): |
| 137 | cur = conn.cursor("foo", binary=True) |
| 138 | cur.execute("select generate_series(1, 2)", binary=False) |
| 139 | assert cur.fetchone() == (1,) |
| 140 | assert cur.pgresult.fformat(0) == 0 |
| 141 | assert cur.pgresult.get_value(0, 0) == b"1" |
| 142 | assert cur.fetchone() == (2,) |
| 143 | assert cur.pgresult.fformat(0) == 0 |
| 144 | assert cur.pgresult.get_value(0, 0) == b"2" |
| 145 | |
| 146 | cur.execute("select generate_series(1, 2)::int4") |
| 147 | assert cur.fetchone() == (1,) |
| 148 | assert cur.pgresult.fformat(0) == 1 |
| 149 | assert cur.pgresult.get_value(0, 0) == b"\x00\x00\x00\x01" |
| 150 | cur.close() |
| 151 | |
| 152 | |
| 153 | def test_close(conn, recwarn): |