E5E9 Allow enums in array codec by fantix · Pull Request #431 · geldata/gel-python · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion edgedb/protocol/codecs/array.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,12 @@ async def test_enum_03(self):
c_red = await self.client.query_single('SELECT <Color>"red"')
c_red2 = await self.client.query_single('SELECT <Color>$0', c_red)
self.assertIs(c_red, c_red2)

async def test_enum_04(self):
enums = await self.client.query_single(
'SELECT <array<Color>>$0', ['red', 'white']
)
enums2 = await self.client.query_single(
'SELECT <array<Color>>$0', enums
)
self.assertEqual(enums, enums2)
0