Skip to content

Commit cb4bc02

Browse files
isidorejmasonleegregorrieglerblade290nitsanavni
committed
- r clean up unused bool
Co-Authored-By: jmasonlee <262853+jmasonlee@users.noreply.github.com> Co-Authored-By: Gregor Riegler <rieglerg85@gmail.com> Co-Authored-By: blade290 <43077216+blade290@users.noreply.github.com> Co-Authored-By: Nitsan Avni <nitsanav@gmail.com> Co-Authored-By: bhargavgundu <7643639+bhargavgundu@users.noreply.github.com>
1 parent 9a7a8e4 commit cb4bc02

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

approvaltests/inline/inline_options.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ def semi_automatic():
2727
class SemiAutomaticInlineOptions(InlineOptions):
2828
def apply(self, options: "Options") -> "Options":
2929
return options.with_reporter(
30-
InlinePythonReporter(
31-
ReporterThatAutomaticallyApproves(), add_approval_line=False, previous_result=lambda __: DELETE_ME_TO_APPROVE_
32-
)
30+
InlinePythonReporter(ReporterThatAutomaticallyApproves(),
31+
footer=lambda __: DELETE_ME_TO_APPROVE_)
3332
)
3433

3534
return SemiAutomaticInlineOptions()
@@ -70,9 +69,8 @@ def create_previous_capture_suffix(approved_path):
7069
class PreviousCaptureInlineOptions(InlineOptions):
7170
def apply(self, options: "Options") -> "Options":
7271
return options.with_reporter(
73-
InlinePythonReporter(
74-
ReporterThatAutomaticallyApproves(), add_approval_line=False, previous_result=create_previous_capture_suffix
75-
)
72+
InlinePythonReporter(ReporterThatAutomaticallyApproves(),
73+
footer=create_previous_capture_suffix)
7674
)
7775

7876
return PreviousCaptureInlineOptions()

approvaltests/namer/inline_python_reporter.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111

1212

1313
class InlinePythonReporter(Reporter):
14-
def __init__(self, reporter, add_approval_line=False, previous_result=None):
14+
def __init__(self, reporter, footer=None):
1515
self.diffReporter = reporter
16-
self.semi_automatic_extra_line = (
17-
DELETE_ME_TO_APPROVE_ if add_approval_line else ""
18-
)
19-
self.previous_result = previous_result
16+
self.footer = footer
17+
self.semi_automatic_extra_line = ""
2018

2119
def report(self, received_path: str, approved_path: str) -> bool:
2220
test_source_file = self.get_test_source_file()
23-
if self.previous_result:
24-
self.semi_automatic_extra_line = self.previous_result(approved_path)
21+
if self.footer:
22+
self.semi_automatic_extra_line = self.footer(approved_path)
2523
received_path = self.create_received_file(received_path, test_source_file)
2624
return self.diffReporter.report(received_path, test_source_file)
2725

0 commit comments

Comments
 (0)