Skip to content

Added test case for an enum inside of an array #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 18 additions & 0 deletions tests/test_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,3 +1161,21 @@ async def test_unknown_type_text_fallback(self):
await self.con.execute(r'DROP TYPE citext_range')
await self.con.execute(r'DROP TYPE citext_dom')
await self.con.execute(r'DROP EXTENSION citext')

async def test_enum_in_array(self):
await self.con.execute('''
CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi');
''')
result = await self.con.fetchrow('''SELECT $1::enum_t[];''',
['abc'])
self.assertEqual(result, ['abc'])

result = await self.con.fetchrow('''SELECT ARRAY[$1::enum_t];''',
'abc')

self.assertEqual(result, ['abc'])

await self.con.execute('''
DROP TYPE enum_t;
''')