Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 7, 2023
1 parent 4b4856e commit f1a3f88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion python_ta/debug/accumulation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def _record_iteration(self, frame: types.FrameType) -> None:
for accumulator in self.loop_accumulators:
if accumulator in frame.f_locals:
self.loop_accumulators[accumulator].append(copy.copy(frame.f_locals[accumulator]))
elif len(list(self.loop_variables.values())[0]) == 1: # Checks if it's the first iteration
elif (
len(list(self.loop_variables.values())[0]) == 1
): # Checks if it's the first iteration
self.loop_accumulators[accumulator].append("N/A")
else:
raise NameError
Expand Down
4 changes: 2 additions & 2 deletions tests/test_debug/test_accumulation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ def test_loop_variable_initialized_in_loop() -> None:
for number in [10, 20, 30, 40, 50, 60]:
i = number

assert table.loop_variables == {'number': ['N/A', 10, 20, 30, 40, 50, 60]}
assert table.loop_accumulators == {'i': ['N/A', 10, 20, 30, 40, 50, 60]}
assert table.loop_variables == {"number": ["N/A", 10, 20, 30, 40, 50, 60]}
assert table.loop_accumulators == {"i": ["N/A", 10, 20, 30, 40, 50, 60]}


def test_uninitialized_loop_accumulators() -> None:
Expand Down

0 comments on commit f1a3f88

Please sign in to comment.