(self)
| 1638 | ''') |
| 1639 | |
| 1640 | async def test_timetz_encoding(self): |
| 1641 | try: |
| 1642 | async with self.con.transaction(): |
| 1643 | await self.con.execute("SET TIME ZONE 'America/Toronto'") |
| 1644 | # Check decoding: |
| 1645 | row = await self.con.fetchrow( |
| 1646 | 'SELECT extract(epoch from now())::float8 AS epoch, ' |
| 1647 | 'now()::date as date, now()::timetz as time') |
| 1648 | result = datetime.datetime.combine(row['date'], row['time']) |
| 1649 | expected = datetime.datetime.fromtimestamp(row['epoch'], |
| 1650 | tz=result.tzinfo) |
| 1651 | self.assertEqual(result, expected) |
| 1652 | |
| 1653 | # Check encoding: |
| 1654 | res = await self.con.fetchval( |
| 1655 | 'SELECT now() = ($1::date + $2::timetz)', |
| 1656 | row['date'], row['time']) |
| 1657 | self.assertTrue(res) |
| 1658 | finally: |
| 1659 | await self.con.execute('RESET ALL') |
| 1660 | |
| 1661 | async def test_composites_in_arrays(self): |
| 1662 | await self.con.execute(''' |
nothing calls this directly
no test coverage detected