more cache_key coverage

Change-Id: I68ed84c1617b4d15b0103cf4a3debd1da05c6c97
This commit is contained in:
Mike Bayer
2025-10-27 12:18:56 -04:00
parent 21c47ea060
commit 293af0439d
+10 -6
View File
@@ -2,6 +2,7 @@ import importlib
from inspect import signature
import itertools
import random
import re
from sqlalchemy import and_
from sqlalchemy import Boolean
@@ -2318,13 +2319,16 @@ class TypesTest(fixtures.TestBase):
ne_(c1, c3)
class TestWhatsDifferentUtil(fixtures.TestBase):
"""Test the CacheKey._whats_different() utility method
class TestCacheKeyUtil(fixtures.TestBase):
Note: The _whats_different() method has a limitation where it can only
properly handle nested tuple structures. It was designed to work with
real cache keys which are always nested tuples.
"""
def test_str(self):
eq_(
re.compile(r"[\n\s]+", re.M).sub(
" ",
str(CacheKey(key=((1, (2, 7, 4), 5),), bindparams=[])),
),
"CacheKey(key=( ( 1, ( 2, 7, 4, ), 5, ), ),)",
)
def test_nested_tuple_difference(self):
"""Test difference detection in nested tuples"""