From 293af0439d87b51611206a6c8552048b02ddf995 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 27 Oct 2025 12:18:56 -0400 Subject: [PATCH] more cache_key coverage Change-Id: I68ed84c1617b4d15b0103cf4a3debd1da05c6c97 --- test/sql/test_compare.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/sql/test_compare.py b/test/sql/test_compare.py index 94f34ddfff..c1cd9edab1 100644 --- a/test/sql/test_compare.py +++ b/test/sql/test_compare.py @@ -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""" -- 2.47.3