diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-06 16:19:23 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-06 16:19:23 -0400 |
| commit | 9243f6feea676bbaada52293d44e5d069b0f0574 (patch) | |
| tree | 041837150a0cec105532e70f4f0110de4919d070 /test | |
| parent | 2d6146192fbceec12585b6d9977cd818baae85a5 (diff) | |
| download | sqlalchemy-9243f6feea676bbaada52293d44e5d069b0f0574.tar.gz | |
Ensure length parameter of Enum is adapted to new objects
Ensure length parameter added to Enum in
Iea05dc8cd9e33959bb968b394fb10a7dd068c873 is correctly propagated
to new enum objects adapted from this one.
Fixes: #5183
`
Change-Id: I7f20d926f73ec8260938963df87e29894c7e55e2
Diffstat (limited to 'test')
| -rw-r--r-- | test/sql/test_types.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py index aca9a5b06..4b1fb6a72 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -1803,6 +1803,18 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest): eq_(e1_vc.adapt(ENUM).name, "someotherenum") eq_(e1_vc.adapt(ENUM).enums, ["1", "2", "3", "a", "b"]) + def test_adapt_length(self): + from sqlalchemy.dialects.postgresql import ENUM + + e1 = Enum("one", "two", "three", length=50, native_enum=False) + eq_(e1.adapt(ENUM).length, 50) + eq_(e1.adapt(Enum).length, 50) + + e1 = Enum("one", "two", "three") + eq_(e1.length, 5) + eq_(e1.adapt(ENUM).length, 5) + eq_(e1.adapt(Enum).length, 5) + @testing.provide_metadata def test_create_metadata_bound_no_crash(self): m1 = self.metadata |
