MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_cache_key_gen

Method test_cache_key_gen

test/orm/test_cache_key.py:1142–1168  ·  test/orm/test_cache_key.py::EmbeddedSubqTest.test_cache_key_gen
(self, assert_on)

Source from the content-addressed store, hash-verified

1140 argnames=class="st">"assert_on",
1141 )
1142 def test_cache_key_gen(self, assert_on):
1143 Employee = self.classes.Employee
1144
1145 e1 = aliased(Employee)
1146 e2 = aliased(Employee)
1147
1148 subq = select(e1).union_all(select(e2)).subquery()
1149
1150 anno = aliased(Employee, subq)
1151
1152 stmt = select(anno)
1153
1154 ck = stmt._generate_cache_key()
1155
1156 if assert_on == class="st">"tuples":
1157 class="cm"># before the fix for #8790 this was 700
1158 int_within_variance(142, count_cache_key_tuples(ck), 0.05)
1159
1160 elif assert_on == class="st">"memory":
1161 class="cm"># before the fix for #8790 this was 55154
1162
1163 if util.py312:
1164 testing.skip_test(class="st">"python platform not available")
1165 elif util.py311:
1166 int_within_variance(39996, total_size(ck), 0.05)
1167 else:
1168 int_within_variance(29796, total_size(ck), 0.05)
1169
1170
1171class WithExpresionLoaderOptTest(DeclarativeMappedTest):

Callers

nothing calls this directly

Calls 9

aliasedFunction · 0.90
selectFunction · 0.90
int_within_varianceFunction · 0.90
count_cache_key_tuplesFunction · 0.90
total_sizeFunction · 0.90
skip_testMethod · 0.80
subqueryMethod · 0.45
union_allMethod · 0.45
_generate_cache_keyMethod · 0.45

Tested by

no test coverage detected