Skip to content

Commit 422e424

Browse files
zzzeekGerrit Code Review
authored andcommitted
Merge "additional enum test with metadata" into main
2 parents 637159a + 00a4b04 commit 422e424

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_autogen_render.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
from alembic.testing import eq_
5050
from alembic.testing import eq_ignore_whitespace
5151
from alembic.testing import mock
52+
from alembic.testing import is_not_
5253
from alembic.testing import TestBase
5354
from alembic.testing.fixtures import op_fixture
5455
from alembic.util import sqla_compat
@@ -1797,6 +1798,17 @@ def test_render_non_native_enum(self):
17971798
f"sa.Enum('one', 'two', 'three'{extra}, native_enum=False)",
17981799
)
17991800

1801+
def test_render_enum_in_table(self):
1802+
e = Enum("one", "two", "three")
1803+
_ = Table("t", MetaData(), Column("x", e))
1804+
if sqla_compat.sqla_2_1:
1805+
is_not_(e.metadata, None)
1806+
enum, extra = self._check_enum_inherit_schema(e)
1807+
eq_ignore_whitespace(
1808+
autogenerate.render._repr_type(enum, self.autogen_context),
1809+
f"sa.Enum('one', 'two', 'three'{extra})",
1810+
)
1811+
18001812
def test_repr_plain_sqla_type(self):
18011813
type_ = Integer()
18021814
eq_ignore_whitespace(

0 commit comments

Comments
 (0)