Test encoding/decoding of composite types.
(self)
| 1020 | await self.con.execute('DROP TYPE test_composite') |
| 1021 | |
| 1022 | async def test_domains(self): |
| 1023 | """Test encoding/decoding of composite types.""" |
| 1024 | await self.con.execute(''' |
| 1025 | CREATE DOMAIN my_dom AS int |
| 1026 | ''') |
| 1027 | |
| 1028 | await self.con.execute(''' |
| 1029 | CREATE DOMAIN my_dom2 AS my_dom |
| 1030 | ''') |
| 1031 | |
| 1032 | try: |
| 1033 | st = await self.con.prepare(''' |
| 1034 | SELECT 3::my_dom2 |
| 1035 | ''') |
| 1036 | res = await st.fetchval() |
| 1037 | |
| 1038 | self.assertEqual(res, 3) |
| 1039 | |
| 1040 | st = await self.con.prepare(''' |
| 1041 | SELECT NULL::my_dom2 |
| 1042 | ''') |
| 1043 | res = await st.fetchval() |
| 1044 | |
| 1045 | self.assertIsNone(res) |
| 1046 | |
| 1047 | at = st.get_attributes() |
| 1048 | self.assertEqual(len(at), 1) |
| 1049 | self.assertEqual(at[0].name, 'my_dom2') |
| 1050 | self.assertEqual(at[0].type.name, 'int4') |
| 1051 | self.assertEqual(at[0].type.kind, 'scalar') |
| 1052 | |
| 1053 | finally: |
| 1054 | await self.con.execute('DROP DOMAIN my_dom2') |
| 1055 | await self.con.execute('DROP DOMAIN my_dom') |
| 1056 | |
| 1057 | async def test_range_types(self): |
| 1058 | """Test encoding/decoding of range types.""" |
nothing calls this directly
no test coverage detected