From: Federico Caselli Date: Mon, 23 Feb 2026 21:33:36 +0000 (+0100) Subject: additional enum test with metadata X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00a4b04fc5ae787931c2dd5ffc004b1c631b80b7;p=thirdparty%2Fsqlalchemy%2Falembic.git additional enum test with metadata This is a regression test for Ic65e9572ff24af8d48e15277cbc824f7c5ce845a in sqlalchemy Change-Id: I1725f30c9eefa97e935be5346445bbf653a1d8ae --- diff --git a/tests/test_autogen_render.py b/tests/test_autogen_render.py index c5f5565c..dca63ce8 100644 --- a/tests/test_autogen_render.py +++ b/tests/test_autogen_render.py @@ -49,6 +49,7 @@ from alembic.testing import config from alembic.testing import eq_ from alembic.testing import eq_ignore_whitespace from alembic.testing import mock +from alembic.testing import is_not_ from alembic.testing import TestBase from alembic.testing.fixtures import op_fixture from alembic.util import sqla_compat @@ -1797,6 +1798,17 @@ class AutogenRenderTest(TestBase): f"sa.Enum('one', 'two', 'three'{extra}, native_enum=False)", ) + def test_render_enum_in_table(self): + e = Enum("one", "two", "three") + _ = Table("t", MetaData(), Column("x", e)) + if sqla_compat.sqla_2_1: + is_not_(e.metadata, None) + enum, extra = self._check_enum_inherit_schema(e) + eq_ignore_whitespace( + autogenerate.render._repr_type(enum, self.autogen_context), + f"sa.Enum('one', 'two', 'three'{extra})", + ) + def test_repr_plain_sqla_type(self): type_ = Integer() eq_ignore_whitespace(