We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0cec064 commit e306a99Copy full SHA for e306a99
1 file changed
hypothesis-python/tests/cover/test_reflection.py
@@ -752,6 +752,16 @@ def test_is_unrecognized_identity(f):
752
assert not is_identity_function(f)
753
754
755
+def test_cache_key_size_is_bounded():
756
+ # Modify co_consts because ("a" * 1000) may not be evaluated at compile time
757
+ f = lambda: "a"
758
+ f.__code__ = f.__code__.replace(
759
+ co_consts=tuple(c*1000 if c=="a" else c for c in f.__code__.co_consts)
760
+ )
761
+ assert len(repr(reflection._lambda_source_key(f))) > 1000
762
+ assert len(repr(reflection._lambda_source_key(f, bounded_size=True))) < 1000
763
+
764
765
def test_lambda_source_key_distinguishes_alpha_renames():
766
# these terms are equivalent under the lambda calculus, but their
767
# representations are not, so they should be cached differently.
0 commit comments