| 1339 | ) |
| 1340 | |
| 1341 | def test_extract(self, connection): |
| 1342 | fivedaysago = connection.execute( |
| 1343 | select(func.now().op("at time zone")("UTC")) |
| 1344 | ).scalar() - datetime.timedelta(days=5) |
| 1345 | |
| 1346 | for field, exp in ( |
| 1347 | ("year", fivedaysago.year), |
| 1348 | ("month", fivedaysago.month), |
| 1349 | ("day", fivedaysago.day), |
| 1350 | ): |
| 1351 | r = connection.execute( |
| 1352 | select( |
| 1353 | extract( |
| 1354 | field, |
| 1355 | func.now().op("at time zone")("UTC") |
| 1356 | + datetime.timedelta(days=-5), |
| 1357 | ) |
| 1358 | ) |
| 1359 | ).scalar() |
| 1360 | eq_(r, exp) |
| 1361 | |
| 1362 | @testing.combinations( |
| 1363 | ("fooseq", None), |