MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _test

Method _test

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

Source from the content-addressed store, hash-verified

1399 )
1400
1401 def _test(self, connection, expr, field="all", overrides=None):
1402 t = self.tables.t
1403
1404 if field == "all":
1405 fields = {
1406 "year": 2012,
1407 "month": 5,
1408 "day": 10,
1409 "epoch": 1336652125.0,
1410 "hour": 12,
1411 "minute": 15,
1412 }
1413 elif field == "time":
1414 fields = {"hour": 12, "minute": 15, "second": 25}
1415 elif field == "date":
1416 fields = {"year": 2012, "month": 5, "day": 10}
1417 elif field == "all+tz":
1418 fields = {
1419 "year": 2012,
1420 "month": 5,
1421 "day": 10,
1422 "epoch": 1336637725.0,
1423 "hour": 8,
1424 "timezone": 0,
1425 }
1426 else:
1427 fields = field
1428
1429 if overrides:
1430 fields.update(overrides)
1431
1432 for field in fields:
1433 result = connection.execute(
1434 select(extract(field, expr)).select_from(t)
1435 ).scalar()
1436 eq_(result, fields[field])
1437
1438 def test_one(self, connection):
1439 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