MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _assert_opts

Method _assert_opts

test/orm/test_options.py:1386–1415  ·  view source on GitHub ↗
(self, q, sub_opt, non_sub_opts)

Source from the content-addressed store, hash-verified

1384 run_deletes = None
1385
1386 def _assert_opts(self, q, sub_opt, non_sub_opts):
1387 attr_a = {}
1388
1389 q1 = q.options(sub_opt)._compile_context()
1390 q2 = q.options(*non_sub_opts)._compile_context()
1391
1392 attr_a = {
1393 k: v
1394 for k, v in q1.attributes.items()
1395 if isinstance(k, tuple) and k[0] == "loader"
1396 }
1397 attr_b = {
1398 k: v
1399 for k, v in q2.attributes.items()
1400 if isinstance(k, tuple) and k[0] == "loader"
1401 }
1402
1403 def strat_as_tuple(strat):
1404 return (
1405 strat.strategy,
1406 strat.local_opts,
1407 getattr(strat, "_of_type", None),
1408 strat.is_class_strategy,
1409 strat.is_opts_only,
1410 )
1411
1412 eq_(
1413 {path: strat_as_tuple(load) for path, load in attr_a.items()},
1414 {path: strat_as_tuple(load) for path, load in attr_b.items()},
1415 )
1416
1417 def test_one(self):
1418 User, Address, Order, Item, SubItem = self.classes(

Callers 5

test_oneMethod · 0.95
test_twoMethod · 0.95
test_threeMethod · 0.95
test_fourMethod · 0.95
test_fiveMethod · 0.95

Calls 4

eq_Function · 0.90
_compile_contextMethod · 0.80
optionsMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected