Skip to content

Commit

Permalink
Add a test for ENUM type
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans committed Jan 20, 2017
1 parent 81365dc commit 5706fe3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_codecs.py
Expand Up @@ -1028,3 +1028,28 @@ async def test_relacl_array_type(self):
DROP USER norm1;
DROP USER norm2;
''')

async def test_enum(self):
await self.con.execute('''
CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi');
CREATE TABLE tab (
a text,
b enum_t
);
INSERT INTO tab (a, b) VALUES ('foo', 'abc');
INSERT INTO tab (a, b) VALUES ('bar', 'def');
''')

try:
for i in range(10):
r = await self.con.fetch('''
SELECT a, b FROM tab ORDER BY b
''')

self.assertEqual(r, [('foo', 'abc'), ('bar', 'def')])

finally:
await self.con.execute('''
DROP TABLE tab;
DROP TYPE enum_t;
''')

0 comments on commit 5706fe3

Please sign in to comment.