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

Method go

test/orm/test_query.py:712–753  ·  view source on GitHub ↗
(stmt, expected, coreorm_exec, selected_columns=None)

Source from the content-addressed store, hash-verified

710 @testing.fixture
711 def assert_row_keys(self):
712 def go(stmt, expected, coreorm_exec, selected_columns=None):
713 if coreorm_exec == "core":
714 with testing.db.connect() as conn:
715 row = conn.execute(stmt).first()
716 else:
717 s = fixture_session()
718
719 row = s.execute(stmt).first()
720
721 eq_(row._mapping.keys(), expected)
722
723 if selected_columns is None:
724 selected_columns = expected
725
726 # we are disambiguating in exported_columns even if
727 # LABEL_STYLE_NONE, this seems weird also
728 if (
729 stmt._label_style is not LABEL_STYLE_NONE
730 and coreorm_exec == "core"
731 ):
732 eq_(stmt.exported_columns.keys(), list(selected_columns))
733
734 if (
735 stmt._label_style is not LABEL_STYLE_NONE
736 and coreorm_exec == "orm"
737 ):
738 for k in expected:
739 is_not_none(getattr(row, k))
740
741 try:
742 column_descriptions = stmt.column_descriptions
743 except (NotImplementedError, AttributeError):
744 pass
745 else:
746 eq_(
747 [
748 entity["name"]
749 for entity in column_descriptions
750 if entity["name"] is not None
751 ],
752 list(selected_columns),
753 )
754
755 return go
756

Callers

nothing calls this directly

Calls 7

fixture_sessionFunction · 0.90
eq_Function · 0.90
is_not_noneFunction · 0.90
connectMethod · 0.45
firstMethod · 0.45
executeMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected