Skip to content

Commit e9ca727

Browse files
committed
. d updated markdown snippets
1 parent 1b17eaf commit e9ca727

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

approvaltests/inline/inline_options.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
DELETE_ME_TO_APPROVE_ = "\n***** DELETE ME TO APPROVE *****"
66

7+
78
class InlineOptions:
89

910
@staticmethod
@@ -27,8 +28,10 @@ def semi_automatic():
2728
class SemiAutomaticInlineOptions(InlineOptions):
2829
def apply(self, options: "Options") -> "Options":
2930
return options.with_reporter(
30-
InlinePythonReporter(ReporterThatAutomaticallyApproves(),
31-
create_footer_function=lambda __: DELETE_ME_TO_APPROVE_)
31+
InlinePythonReporter(
32+
ReporterThatAutomaticallyApproves(),
33+
create_footer_function=lambda __: DELETE_ME_TO_APPROVE_,
34+
)
3235
)
3336

3437
return SemiAutomaticInlineOptions()
@@ -48,8 +51,10 @@ def create_previous_capture_footer(approved_path):
4851
class PreviousCaptureInlineOptions(InlineOptions):
4952
def apply(self, options: "Options") -> "Options":
5053
return options.with_reporter(
51-
InlinePythonReporter(ReporterThatAutomaticallyApproves(),
52-
create_footer_function=create_previous_capture_footer)
54+
InlinePythonReporter(
55+
ReporterThatAutomaticallyApproves(),
56+
create_footer_function=create_previous_capture_footer,
57+
)
5358
)
5459

5560
return PreviousCaptureInlineOptions()
@@ -71,5 +76,3 @@ def apply(self, options: "Options") -> "Options":
7176
return options
7277

7378
return ShowCodeInlineOptions() if do_show_code else DoNotShowCodeInlineOptions()
74-
75-

approvaltests/namer/inline_python_reporter.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
from approvaltests import Reporter, StackFrameNamer
77
from approvaltests.inline.split_code import SplitCode
88

9+
910
class InlinePythonReporter(Reporter):
10-
def __init__(self, reporter: Reporter, create_footer_function: Callable[[str],str]=None):
11+
def __init__(
12+
self, reporter: Reporter, create_footer_function: Callable[[str], str] = None
13+
):
1114
self.diffReporter = reporter
1215
self.footer_function = create_footer_function or (lambda __: "")
1316
self.footer = ""
@@ -25,9 +28,7 @@ def get_test_source_file(self):
2528
def create_received_file(self, received_path: str, test_source_file: str):
2629
code = Path(test_source_file).read_text()
2730

28-
received_text = (
29-
Path(received_path).read_text()[:-1] + self.footer
30-
)
31+
received_text = Path(received_path).read_text()[:-1] + self.footer
3132
method_name = StackFrameNamer.get_test_frame().function
3233
new_code = self.swap(received_text, code, method_name)
3334
file = tempfile.NamedTemporaryFile(suffix=".received.txt", delete=False).name

tests/test_inline_approvals.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ def test_inline_with_additional_reporter():
188188
"hello\nworld",
189189
options=(Options().inline().add_reporter(ReportWithBeyondCompare())),
190190
)
191-
191+
192+
192193
def test_inline_with_preserved_approved_text():
193194
"""
194195
42
@@ -202,7 +203,8 @@ def test_inline_with_preserved_approved_text():
202203
except ApprovalException:
203204
pass
204205
verify(get_approved_via_doc_string())
205-
206+
207+
206208
def test_inline_with_semi_automatic_inline():
207209
"""
208210
42

0 commit comments

Comments
 (0)