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

Method _assert_opts

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

Source from the content-addressed store, hash-verified

1394 run_deletes = None
1395
1396 def _assert_opts(self, q, sub_opt, non_sub_opts):
1397 attr_a = {}
1398
1399 q1 = q.options(sub_opt)._compile_context()
1400 q2 = q.options(*non_sub_opts)._compile_context()
1401
1402 attr_a = {
1403 k: v
1404 for k, v in q1.attributes.items()
1405 if isinstance(k, tuple) and k[0] == "loader"
1406 }
1407 attr_b = {
1408 k: v
1409 for k, v in q2.attributes.items()
1410 if isinstance(k, tuple) and k[0] == "loader"
1411 }
1412
1413 def strat_as_tuple(strat):
1414 return (
1415 strat.strategy,
1416 strat.local_opts,
1417 getattr(strat, "_of_type", None),
1418 strat.is_class_strategy,
1419 strat.is_opts_only,
1420 )
1421
1422 eq_(
1423 {path: strat_as_tuple(load) for path, load in attr_a.items()},
1424 {path: strat_as_tuple(load) for path, load in attr_b.items()},
1425 )
1426
1427 def test_one(self):
1428 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