@@ -75,7 +75,10 @@ class TestShouldRetryNode:
7575
7676 def test_no_config_never_retries (self ):
7777 """Without a retry config, a node is never retried."""
78- assert _should_retry_node (RuntimeError (), None , NodeState (attempt_count = 1 )) is False
78+ assert (
79+ _should_retry_node (RuntimeError (), None , NodeState (attempt_count = 1 ))
80+ is False
81+ )
7982
8083 @pytest .mark .parametrize ("max_attempts" , [0 , 1 ])
8184 def test_max_attempts_zero_or_one_disables_retries (self , max_attempts ):
@@ -86,19 +89,37 @@ def test_max_attempts_zero_or_one_disables_retries(self, max_attempts):
8689 """
8790 config = RetryConfig (max_attempts = max_attempts )
8891
89- assert _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 1 )) is False
92+ assert (
93+ _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 1 ))
94+ is False
95+ )
9096
9197 def test_retries_until_max_attempts (self ):
9298 """A node is retried while attempt_count is below max_attempts."""
9399 config = RetryConfig (max_attempts = 3 )
94100
95- assert _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 1 )) is True
96- assert _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 2 )) is True
97- assert _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 3 )) is False
101+ assert (
102+ _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 1 ))
103+ is True
104+ )
105+ assert (
106+ _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 2 ))
107+ is True
108+ )
109+ assert (
110+ _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 3 ))
111+ is False
112+ )
98113
99114 def test_unset_max_attempts_defaults_to_five (self ):
100115 """When max_attempts is unset (None), the default of 5 applies."""
101116 config = RetryConfig ()
102117
103- assert _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 4 )) is True
104- assert _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 5 )) is False
118+ assert (
119+ _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 4 ))
120+ is True
121+ )
122+ assert (
123+ _should_retry_node (RuntimeError (), config , NodeState (attempt_count = 5 ))
124+ is False
125+ )
0 commit comments