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

Method test_extract_bind

test/sql/test_functions.py:1321–1337  ·  view source on GitHub ↗

Basic common denominator execution tests for extract()

(self, connection)

Source from the content-addressed store, hash-verified

1319 assert x == y == z == w
1320
1321 def test_extract_bind(self, connection):
1322 """Basic common denominator execution tests for extract()"""
1323
1324 date = datetime.date(2010, 5, 1)
1325
1326 def execute(field):
1327 return connection.execute(select(extract(field, date))).scalar()
1328
1329 assert execute("year") == 2010
1330 assert execute("month") == 5
1331 assert execute("day") == 1
1332
1333 date = datetime.datetime(2010, 5, 1, 12, 11, 10)
1334
1335 assert execute("year") == 2010
1336 assert execute("month") == 5
1337 assert execute("day") == 1
1338
1339 @testing.provide_metadata
1340 def test_extract_expression(self, connection):

Callers

nothing calls this directly

Calls 3

executeFunction · 0.85
dateMethod · 0.45
datetimeMethod · 0.45

Tested by

no test coverage detected