|
3 | 3 | from sqlalchemy.testing.suite import CTETest as _CTETest
|
4 | 4 | from sqlalchemy.testing.suite import DifficultParametersTest as _DifficultParametersTest
|
5 | 5 | from sqlalchemy.testing import fixtures
|
| 6 | +from sqlalchemy.testing.assertions import eq_ |
| 7 | +from sqlalchemy.testing import config |
6 | 8 | from sqlalchemy.orm import Session
|
7 | 9 | from sqlalchemy import testing
|
8 |
| -from sqlalchemy import Table, Column, Integer, String, select |
| 10 | +from sqlalchemy import Table, Column, select |
| 11 | +from sqlalchemy.types import Integer |
| 12 | +from sqlalchemy.types import String |
| 13 | +from sqlalchemy.types import VARBINARY |
| 14 | +from sqlalchemy.types import BINARY |
9 | 15 | import pytest
|
10 | 16 |
|
11 | 17 | from sqlalchemy.testing.suite import * # noqa
|
@@ -149,4 +155,35 @@ def test_exists(self):
|
149 | 155 | .where(self.tables.users.c.user_name == "nope")
|
150 | 156 | .exists()
|
151 | 157 | ).scalar()
|
152 |
| - |
| 158 | + |
| 159 | + |
| 160 | +class IRISBinaryTest(fixtures.TablesTest): |
| 161 | + __backend__ = True |
| 162 | + |
| 163 | + @classmethod |
| 164 | + def define_tables(cls, metadata): |
| 165 | + Table( |
| 166 | + "data", |
| 167 | + metadata, |
| 168 | + Column("bin1", BINARY(50)), |
| 169 | + Column("bin2", VARBINARY(50)), |
| 170 | + ) |
| 171 | + |
| 172 | + @classmethod |
| 173 | + def insert_data(cls, connection): |
| 174 | + connection.execute( |
| 175 | + cls.tables.data.insert(), |
| 176 | + [ |
| 177 | + {"bin1": b"test", "bin2": b"test"}, |
| 178 | + ], |
| 179 | + ) |
| 180 | + |
| 181 | + def _assert_result(self, select, result): |
| 182 | + with config.db.connect() as conn: |
| 183 | + eq_(conn.execute(select).fetchall(), result) |
| 184 | + |
| 185 | + def test_expect_bytes(self): |
| 186 | + self._assert_result( |
| 187 | + select(self.tables.data), |
| 188 | + [(b"test", b"test")], |
| 189 | + ) |
0 commit comments