MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_typing_construction

Method test_typing_construction

test/sql/test_text.py:376–399  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

374 assert compare[k]._type_affinity is map_[k]._type_affinity
375
376 def test_typing_construction(self):
377 t = text("select * from table :foo :bar :bat")
378
379 self._assert_type_map(
380 t, {"foo": NullType(), "bar": NullType(), "bat": NullType()}
381 )
382
383 t = t.bindparams(bindparam("foo", type_=String))
384
385 self._assert_type_map(
386 t, {"foo": String(), "bar": NullType(), "bat": NullType()}
387 )
388
389 t = t.bindparams(bindparam("bar", type_=Integer))
390
391 self._assert_type_map(
392 t, {"foo": String(), "bar": Integer(), "bat": NullType()}
393 )
394
395 t = t.bindparams(bat=45.564)
396
397 self._assert_type_map(
398 t, {"foo": String(), "bar": Integer(), "bat": Float()}
399 )
400
401 def test_binds_compiled_named(self):
402 self.assert_compile(

Callers

nothing calls this directly

Calls 8

_assert_type_mapMethod · 0.95
textFunction · 0.90
NullTypeClass · 0.90
bindparamFunction · 0.90
StringClass · 0.90
IntegerClass · 0.90
FloatClass · 0.90
bindparamsMethod · 0.45

Tested by

no test coverage detected