MCPcopy
hub / github.com/MagicStack/asyncpg / test_enum_and_range

Method test_enum_and_range

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

Source from the content-addressed store, hash-verified

1871 ''')
1872
1873 async def test_enum_and_range(self):
1874 await self.con.execute('''
1875 CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi');
1876 CREATE TABLE testtab (
1877 a int4range,
1878 b enum_t
1879 );
1880
1881 INSERT INTO testtab VALUES (
1882 '[10, 20)', 'abc'
1883 );
1884 ''')
1885
1886 try:
1887 result = await self.con.fetchrow('''
1888 SELECT testtab.a FROM testtab WHERE testtab.b = $1
1889 ''', 'abc')
1890
1891 self.assertEqual(result, (asyncpg.Range(10, 20),))
1892 finally:
1893 await self.con.execute('''
1894 DROP TABLE testtab;
1895 DROP TYPE enum_t;
1896 ''')
1897
1898 async def test_enum_in_composite(self):
1899 await self.con.execute('''

Callers

nothing calls this directly

Calls 2

executeMethod · 0.45
fetchrowMethod · 0.45

Tested by

no test coverage detected