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

Method randomized_param_order_update

test/sql/test_update.py:863–885  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

861
862 @testing.fixture
863 def randomized_param_order_update(self):
864 from sqlalchemy.sql.dml import UpdateDMLState
865
866 super_process_ordered_values = UpdateDMLState._process_ordered_values
867
868 # this fixture is needed for Python 3.6 and above to work around
869 # dictionaries being insert-ordered. in python 2.7 the previous
870 # logic fails pretty easily without this fixture.
871 def _process_ordered_values(self, statement):
872 super_process_ordered_values(self, statement)
873
874 tuples = list(self._dict_parameters.items())
875 random.shuffle(tuples)
876 self._dict_parameters = dict(tuples)
877
878 dialect = default.StrCompileDialect()
879 dialect.paramstyle = "qmark"
880 dialect.positional = True
881
882 with mock.patch.object(
883 UpdateDMLState, "_process_ordered_values", _process_ordered_values
884 ):
885 yield
886
887 def random_update_order_parameters():
888 from sqlalchemy import ARRAY

Callers

nothing calls this directly

Calls 1

objectMethod · 0.80

Tested by

no test coverage detected