Method: pylint.testutils.functional.lint_module_output_update.LintModuleOutputUpdate._check_output_text
Calls: 2, Exceptions: 0, Paths: 2Back
Path 1: 1 calls (0.5)
Counter (1)
[] (1)
list (1)
1def _check_output_text(
2 self,
3 _: MessageCounter,
4 expected_output: list[OutputLine],
5 actual_output: list[OutputLine],
6 ) -> None:
7 """Overwrite or remove the expected output file based on actual output."""
8 # Remove the file if no output is actually expected and a file exists
9 if not expected_output and not actual_output:
10 if os.path.exists(self._test_file.expected_output):
11 os.remove(self._test_file.expected_output)
12 return
13 # Write file with expected output
14 with open(self._test_file.expected_output, "w", encoding="utf-8") as f:
15 writer = csv.writer(f, dialect="test")
16 for line in actual_output:
17 writer.writerow(line.to_csv())
Path 2: 1 calls (0.5)
Counter (1)
[] (1)
[] (1)
None (1)
1def _check_output_text(
2 self,
3 _: MessageCounter,
4 expected_output: list[OutputLine],
5 actual_output: list[OutputLine],
6 ) -> None:
7 """Overwrite or remove the expected output file based on actual output."""
8 # Remove the file if no output is actually expected and a file exists
9 if not expected_output and not actual_output:
10 if os.path.exists(self._test_file.expected_output):
11 os.remove(self._test_file.expected_output)
12 return
13 # Write file with expected output
14 with open(self._test_file.expected_output, "w", encoding="utf-8") as f:
15 writer = csv.writer(f, dialect="test")
16 for line in actual_output:
17 writer.writerow(line.to_csv())