Skip to content

Commit f0fa7e9

Browse files
committed
IfThis.isAllOf and isAnyOf
1 parent 14f0119 commit f0fa7e9

3 files changed

Lines changed: 116 additions & 380 deletions

File tree

tests/support/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,14 +2318,15 @@ def set_recursion_limit(limit):
23182318
finally:
23192319
sys.setrecursionlimit(original_limit)
23202320

2321-
def infinite_recursion(max_depth=None):
2321+
def infinite_recursion(max_depth: int | None = None) -> contextlib._GeneratorContextManager[types.NoneType, types.NoneType, types.NoneType]:
23222322
if max_depth is None:
23232323
# Pick a number large enough to cause problems
23242324
# but not take too long for code that can handle
23252325
# very deep recursion.
23262326
max_depth = 20_000
23272327
elif max_depth < 3:
2328-
raise ValueError(f"max_depth must be at least 3, got {max_depth}")
2328+
message = f"max_depth must be at least 3, got {max_depth}"
2329+
raise ValueError(message)
23292330
depth = get_recursion_depth()
23302331
depth = max(depth - 1, 1) # Ignore infinite_recursion() frame.
23312332
limit = depth + max_depth

tests/support/ast_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class ASTTestMixin:
44
"""Test mixing to have basic assertions for AST nodes."""
55

6-
def assertASTEqual(self, ast1, ast2):
6+
def assertASTEqual(self, ast1: ast.AST, ast2: ast.AST) -> None:
77
# Ensure the comparisons start at an AST node
88
self.assertIsInstance(ast1, ast.AST)
99
self.assertIsInstance(ast2, ast.AST)

0 commit comments

Comments
 (0)