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

Method test_via_column

test/sql/test_resultset.py:2902–2916  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

2900 )
2901
2902 def test_via_column(self, connection):
2903 c1, c2, c3, c4 = column("q"), column("p"), column("r"), column("d")
2904 stmt = text("select a, b, c, d from text1").columns(c1, c2, c3, c4)
2905
2906 result = connection.execute(stmt)
2907 row = result.first()
2908
2909 eq_(row._mapping[c2], "b1")
2910 eq_(row._mapping[c4], "d1")
2911 eq_(row[1], "b1")
2912 eq_(row._mapping["b"], "b1")
2913 eq_(list(row._mapping.keys()), ["a", "b", "c", "d"])
2914 eq_(row._fields, ("a", "b", "c", "d"))
2915 eq_(row._mapping["r"], "c1")
2916 eq_(row._mapping["d"], "d1")
2917
2918 def test_fewer_cols_than_sql_positional(self, connection):
2919 c1, c2 = column("q"), column("p")

Callers

nothing calls this directly

Calls 7

columnFunction · 0.90
textFunction · 0.90
eq_Function · 0.90
columnsMethod · 0.45
executeMethod · 0.45
firstMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected