|
14 | 14 | from sqlalchemy.types import String
|
15 | 15 | from sqlalchemy.types import VARBINARY
|
16 | 16 | from sqlalchemy.types import BINARY
|
| 17 | +from sqlalchemy_iris import TINYINT |
| 18 | +from sqlalchemy.exc import DatabaseError |
17 | 19 | import pytest
|
18 | 20 |
|
19 | 21 | from sqlalchemy.testing.suite import * # noqa
|
@@ -71,6 +73,39 @@ def test_simple_limit_offset_no_order(self, connection, cases):
|
71 | 73 | )
|
72 | 74 |
|
73 | 75 |
|
| 76 | +class TinyintTest(fixtures.TablesTest): |
| 77 | + __backend__ = True |
| 78 | + |
| 79 | + @classmethod |
| 80 | + def define_tables(cls, metadata): |
| 81 | + Table( |
| 82 | + "test_tinyint", |
| 83 | + metadata, |
| 84 | + Column("val_tinyint", TINYINT), |
| 85 | + ) |
| 86 | + |
| 87 | + @testing.fixture |
| 88 | + def local_connection(self): |
| 89 | + with testing.db.connect() as conn: |
| 90 | + yield conn |
| 91 | + |
| 92 | + def test_commits(self, local_connection): |
| 93 | + test_tinyint = self.tables.test_tinyint |
| 94 | + connection = local_connection |
| 95 | + |
| 96 | + transaction = connection.begin() |
| 97 | + connection.execute(test_tinyint.insert(), dict(val_tinyint=100)) |
| 98 | + with pytest.raises(DatabaseError): |
| 99 | + connection.execute(test_tinyint.insert(), dict(val_tinyint=129)) |
| 100 | + with pytest.raises(DatabaseError): |
| 101 | + connection.execute(test_tinyint.insert(), dict(val_tinyint=-129)) |
| 102 | + transaction.commit() |
| 103 | + |
| 104 | + result = connection.exec_driver_sql("select * from test_tinyint") |
| 105 | + assert len(result.fetchall()) == 1 |
| 106 | + connection.close() |
| 107 | + |
| 108 | + |
74 | 109 | class TransactionTest(fixtures.TablesTest):
|
75 | 110 | __backend__ = True
|
76 | 111 |
|
|
0 commit comments