MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / test_unconsumed_names_values_dict

Method test_unconsumed_names_values_dict

test/sql/test_update.py:643–670  ·  view source on GitHub ↗
(self, include_in_from, use_mysql)

Source from the content-addressed store, hash-verified

641 @testing.variation("include_in_from", [True, False])
642 @testing.variation("use_mysql", [True, False])
643 def test_unconsumed_names_values_dict(self, include_in_from, use_mysql):
644 t = table("t", column("x"), column("y"))
645 t2 = table("t2", column("q"), column("z"))
646
647 stmt = t.update().values(x=5, j=7).values({t2.c.z: 5})
648 if include_in_from:
649 stmt = stmt.where(t.c.x == t2.c.q)
650
651 if use_mysql:
652 if not include_in_from:
653 msg = (
654 "Statement is not a multi-table UPDATE statement; cannot "
655 r"include columns from table\(s\) 't2' in SET clause"
656 )
657 else:
658 msg = "Unconsumed column names: j"
659 else:
660 msg = (
661 "Backend does not support additional tables in the SET "
662 r"clause; cannot include columns from table\(s\) 't2' in "
663 "SET clause"
664 )
665
666 with expect_raises_message(exc.CompileError, msg):
667 if use_mysql:
668 stmt.compile(dialect=mysql.dialect())
669 else:
670 stmt.compile()
671
672 def test_unconsumed_names_kwargs_w_keys(self):
673 t = table("t", column("x"), column("y"))

Callers

nothing calls this directly

Calls 8

tableFunction · 0.90
columnFunction · 0.90
expect_raises_messageFunction · 0.90
valuesMethod · 0.45
updateMethod · 0.45
whereMethod · 0.45
compileMethod · 0.45
dialectMethod · 0.45

Tested by

no test coverage detected