MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_cache_key_no_method

Method test_cache_key_no_method

test/sql/test_compare.py:1439–1463  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1437 eq_(f1._generate_cache_key(), None)
1438
1439 def test_cache_key_no_method(self):
1440 class Foobar1(ClauseElement):
1441 pass
1442
1443 class Foobar2(ColumnElement):
1444 pass
1445
1446 # the None for cache key will prevent objects
1447 # which contain these elements from being cached.
1448 f1 = Foobar1()
1449 with expect_warnings(
1450 "Class Foobar1 will not make use of SQL compilation caching"
1451 ):
1452 eq_(f1._generate_cache_key(), None)
1453
1454 f2 = Foobar2()
1455 with expect_warnings(
1456 "Class Foobar2 will not make use of SQL compilation caching"
1457 ):
1458 eq_(f2._generate_cache_key(), None)
1459
1460 s1 = select(column("q"), Foobar2())
1461
1462 # warning is memoized, won't happen the second time
1463 eq_(s1._generate_cache_key(), None)
1464
1465 def test_get_children_no_method(self):
1466 class Foobar1(ClauseElement):

Callers

nothing calls this directly

Calls 7

expect_warningsFunction · 0.90
eq_Function · 0.90
selectFunction · 0.90
columnFunction · 0.90
Foobar1Class · 0.85
Foobar2Class · 0.85
_generate_cache_keyMethod · 0.45

Tested by

no test coverage detected