MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_extract

Method test_extract

test/dialect/mysql/test_compiler.py:1276–1289  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1274 )
1275
1276 def test_extract(self):
1277 t = sql.table("t", sql.column("col1"))
1278
1279 for field in "year", "month", "day":
1280 self.assert_compile(
1281 select(extract(field, t.c.col1)),
1282 "SELECT EXTRACT(%s FROM t.col1) AS anon_1 FROM t" % field,
1283 )
1284
1285 # milliseconds to millisecond
1286 self.assert_compile(
1287 select(extract("milliseconds", t.c.col1)),
1288 "SELECT EXTRACT(millisecond FROM t.col1) AS anon_1 FROM t",
1289 )
1290
1291 def test_too_long_index(self):
1292 exp = "ix_zyrenian_zyme_zyzzogeton_zyzzogeton_zyrenian_zyme_zyz_5cd2"

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
extractFunction · 0.90
assert_compileMethod · 0.80
tableMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected