MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _test

Method _test

test/dialect/postgresql/test_query.py:1471–1506  ·  view source on GitHub ↗
(self, connection, expr, field="all", overrides=None)

Source from the content-addressed store, hash-verified

1469 )
1470
1471 def _test(self, connection, expr, field="all", overrides=None):
1472 t = self.tables.t
1473
1474 if field == "all":
1475 fields = {
1476 "year": 2012,
1477 "month": 5,
1478 "day": 10,
1479 "epoch": 1336652125.0,
1480 "hour": 12,
1481 "minute": 15,
1482 }
1483 elif field == "time":
1484 fields = {"hour": 12, "minute": 15, "second": 25}
1485 elif field == "date":
1486 fields = {"year": 2012, "month": 5, "day": 10}
1487 elif field == "all+tz":
1488 fields = {
1489 "year": 2012,
1490 "month": 5,
1491 "day": 10,
1492 "epoch": 1336637725.0,
1493 "hour": 8,
1494 "timezone": 0,
1495 }
1496 else:
1497 fields = field
1498
1499 if overrides:
1500 fields.update(overrides)
1501
1502 for field in fields:
1503 result = connection.execute(
1504 select(extract(field, expr)).select_from(t)
1505 ).scalar()
1506 eq_(result, fields[field])
1507
1508 def test_one(self, connection):
1509 t = self.tables.t

Callers 15

test_oneMethod · 0.95
test_twoMethod · 0.95
test_threeMethod · 0.95
test_fourMethod · 0.95
test_fiveMethod · 0.95
test_sixMethod · 0.95
test_sevenMethod · 0.95
test_eightMethod · 0.95
test_nineMethod · 0.95
test_tenMethod · 0.95
test_elevenMethod · 0.95
test_twelveMethod · 0.95

Calls 7

selectFunction · 0.90
extractFunction · 0.90
eq_Function · 0.90
updateMethod · 0.45
scalarMethod · 0.45
executeMethod · 0.45
select_fromMethod · 0.45

Tested by

no test coverage detected