MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_extract_bind

Method test_extract_bind

test/sql/test_functions.py:1656–1672  ·  view source on GitHub ↗

Basic common denominator execution tests for extract()

(self, connection)

Source from the content-addressed store, hash-verified

1654 assert x == y == z == w
1655
1656 def test_extract_bind(self, connection):
1657 """Basic common denominator execution tests for extract()"""
1658
1659 date = datetime.date(2010, 5, 1)
1660
1661 def execute(field):
1662 return connection.execute(select(extract(field, date))).scalar()
1663
1664 assert execute("year") == 2010
1665 assert execute("month") == 5
1666 assert execute("day") == 1
1667
1668 date = datetime.datetime(2010, 5, 1, 12, 11, 10)
1669
1670 assert execute("year") == 2010
1671 assert execute("month") == 5
1672 assert execute("day") == 1
1673
1674 @testing.provide_metadata
1675 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