Skip to content

Commit bcb9de0

Browse files
tbartelmess1st1
authored andcommitted
Added test case for an enum inside of an array [PR #77]
1 parent a3e9cb4 commit bcb9de0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_codecs.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,3 +1161,20 @@ async def test_unknown_type_text_fallback(self):
11611161
await self.con.execute(r'DROP TYPE citext_range')
11621162
await self.con.execute(r'DROP TYPE citext_dom')
11631163
await self.con.execute(r'DROP EXTENSION citext')
1164+
1165+
async def test_enum_in_array(self):
1166+
await self.con.execute('''
1167+
CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi');
1168+
''')
1169+
result = await self.con.fetchrow('''SELECT $1::enum_t[];''',
1170+
['abc'])
1171+
self.assertEqual(result, (['abc'],))
1172+
1173+
result = await self.con.fetchrow('''SELECT ARRAY[$1::enum_t];''',
1174+
'abc')
1175+
1176+
self.assertEqual(result, (['abc'],))
1177+
1178+
await self.con.execute('''
1179+
DROP TYPE enum_t;
1180+
''')

0 commit comments

Comments
 (0)