Skip to content

Commit c8cc18c

Browse files
committed
. d updated markdown snippets
1 parent 1c941ef commit c8cc18c

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

approvaltests/core/options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@ def inline(self, inline_options: InlineOptions = None) -> "Options":
9090

9191
def add_reporter(self, additional_reporter: Reporter) -> "Options":
9292
from approvaltests.reporters import MultiReporter
93+
9394
return self.with_reporter(MultiReporter(self.reporter, additional_reporter))

approvaltests/reporters/multi_reporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ def __init__(self, *reporters) -> None:
1616
def report(self, received_path, approved_path):
1717
for reporter in self.reporters:
1818
reporter.report(received_path, approved_path)
19-
19+
2020
def __str__(self):
21-
return f"MultiReporter({', '.join([r.__class__.__name__ for r in self.reporters])})"
21+
return f"MultiReporter({', '.join([r.__class__.__name__ for r in self.reporters])})"

docs/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ If you want to set the extension of the approval file, you can now do it through
5353
```py
5454
verify(content, options=Options().for_file.with_extension(".md"))
5555
```
56-
<sup><a href='/tests/test_options.py#L65-L67' title='Snippet source file'>snippet source</a> | <a href='#snippet-options_with_file_extension' title='Start of snippet'>anchor</a></sup>
56+
<sup><a href='/tests/test_options.py#L67-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-options_with_file_extension' title='Start of snippet'>anchor</a></sup>
5757
<!-- endSnippet -->

tests/test_inline_approvals.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
from approvaltests.inline.inline_options import InlineOptions
1717
from approvaltests.inline.parse_docstring import parse_docstring
1818
from approvaltests.reporters.report_quietly import ReportQuietly
19-
from build.lib.approvaltests.reporters.report_with_beyond_compare import ReportWithPycharm, ReportWithBeyondCompare
19+
from build.lib.approvaltests.reporters.report_with_beyond_compare import (
20+
ReportWithPycharm,
21+
ReportWithBeyondCompare,
22+
)
2023

2124

2225
def get_approved_via_doc_string():
@@ -181,4 +184,7 @@ def test_inline_with_additional_reporter():
181184
hello
182185
world
183186
"""
184-
verify("hello\nworld", options=(Options().inline().add_reporter(ReportWithBeyondCompare())))
187+
verify(
188+
"hello\nworld",
189+
options=(Options().inline().add_reporter(ReportWithBeyondCompare())),
190+
)

tests/test_options.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,32 @@ def test_file_extensions():
6969
# end-snippet
7070
verify(content, options=Options().for_file.with_extension("md"))
7171

72+
7273
def test_add_reporter():
7374
# current behaviour, override
74-
options0 = Options().with_reporter(ReportByCreatingDiffFile()).with_reporter(ReportWithPycharm())
75+
options0 = (
76+
Options()
77+
.with_reporter(ReportByCreatingDiffFile())
78+
.with_reporter(ReportWithPycharm())
79+
)
7580
assert type(options0.reporter) == ReportWithPycharm
76-
81+
7782
# current work around, create a MultiReporter
78-
options_multi = Options().with_reporter(MultiReporter(ReportByCreatingDiffFile(), ReportWithPycharm()))
79-
assert str(options_multi.reporter) == 'MultiReporter(ReportByCreatingDiffFile, ReportWithPycharm)'
80-
83+
options_multi = Options().with_reporter(
84+
MultiReporter(ReportByCreatingDiffFile(), ReportWithPycharm())
85+
)
86+
assert (
87+
str(options_multi.reporter)
88+
== "MultiReporter(ReportByCreatingDiffFile, ReportWithPycharm)"
89+
)
90+
8191
# new behaviour, append
82-
options0 = Options().with_reporter(ReportByCreatingDiffFile()).add_reporter(ReportWithPycharm())
83-
assert str(options_multi.reporter) == 'MultiReporter(ReportByCreatingDiffFile, ReportWithPycharm)'
92+
options0 = (
93+
Options()
94+
.with_reporter(ReportByCreatingDiffFile())
95+
.add_reporter(ReportWithPycharm())
96+
)
97+
assert (
98+
str(options_multi.reporter)
99+
== "MultiReporter(ReportByCreatingDiffFile, ReportWithPycharm)"
100+
)

0 commit comments

Comments
 (0)