MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_enum_and_range

Method test_enum_and_range

tests/test_codecs.py:1919–1942  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1917 ''')
1918
1919 async def test_enum_and_range(self):
1920 await self.con.execute('''
1921 CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi');
1922 CREATE TABLE testtab (
1923 a int4range,
1924 b enum_t
1925 );
1926
1927 INSERT INTO testtab VALUES (
1928 '[10, 20)', 'abc'
1929 );
1930 ''')
1931
1932 try:
1933 result = await self.con.fetchrow('''
1934 SELECT testtab.a FROM testtab WHERE testtab.b = $1
1935 ''', 'abc')
1936
1937 self.assertEqual(result, (asyncpg.Range(10, 20),))
1938 finally:
1939 await self.con.execute('''
1940 DROP TABLE testtab;
1941 DROP TYPE enum_t;
1942 ''')
1943
1944 async def test_enum_in_composite(self):
1945 await self.con.execute('''

Callers

nothing calls this directly

Calls 2

executeMethod · 0.45
fetchrowMethod · 0.45

Tested by

no test coverage detected