From 2de7e3fb2e8e1d55bf0e2d8b772465c147a1710a Mon Sep 17 00:00:00 2001 From: Fantix King Date: Thu, 25 May 2023 15:54:26 -0400 Subject: [PATCH] Allow enums in array codec --- edgedb/protocol/codecs/array.pyx | 2 +- tests/test_enum.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/edgedb/protocol/codecs/array.pyx b/edgedb/protocol/codecs/array.pyx index 34cc567b..fb0f872b 100644 --- a/edgedb/protocol/codecs/array.pyx +++ b/edgedb/protocol/codecs/array.pyx @@ -39,7 +39,7 @@ cdef class BaseArrayCodec(BaseCodec): if not isinstance( self.sub_codec, - (ScalarCodec, TupleCodec, NamedTupleCodec, RangeCodec) + (ScalarCodec, TupleCodec, NamedTupleCodec, RangeCodec, EnumCodec) ): raise TypeError( 'only arrays of scalars are supported (got type {!r})'.format( diff --git a/tests/test_enum.py b/tests/test_enum.py index a5e99b15..86bf40b6 100644 --- a/tests/test_enum.py +++ b/tests/test_enum.py @@ -99,3 +99,12 @@ async def test_enum_03(self): c_red = await self.client.query_single('SELECT "red"') c_red2 = await self.client.query_single('SELECT $0', c_red) self.assertIs(c_red, c_red2) + + async def test_enum_04(self): + enums = await self.client.query_single( + 'SELECT >$0', ['red', 'white'] + ) + enums2 = await self.client.query_single( + 'SELECT >$0', enums + ) + self.assertEqual(enums, enums2)