diff --git a/tests/test_suite.py b/tests/test_suite.py index a77f6b9..2d531aa 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -1,3 +1,5 @@ +from enum import Enum + from sqlalchemy.testing.suite import FetchLimitOffsetTest as _FetchLimitOffsetTest from sqlalchemy.testing.suite import CompoundSelectTest as _CompoundSelectTest from sqlalchemy.testing.suite import CTETest as _CTETest @@ -187,3 +189,41 @@ def test_expect_bytes(self): select(self.tables.data), [(b"test", b"test")], ) + + +class SomeType(str, Enum): + FIRST = "first value" + SECOND = "second value" + + +class IRISEnumTest(fixtures.TablesTest): + __backend__ = True + + @classmethod + def define_tables(cls, metadata): + Table( + "data", + metadata, + Column("val", String(50)), + ) + + @classmethod + def insert_data(cls, connection): + connection.execute( + cls.tables.data.insert(), + [ + {"val": SomeType.FIRST}, + {"val": SomeType.SECOND}, + {"val": None}, + ], + ) + + def _assert_result(self, select, result): + with config.db.connect() as conn: + eq_(conn.execute(select).fetchall(), result) + + def test_expect_bytes(self): + self._assert_result( + select(self.tables.data), + [(SomeType.FIRST,), (SomeType.SECOND,), (None,)], + )