-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- F BREAKING CHANGE Options.inline() takes InlineOptions
Co-Authored-By: Nitsan Avni <nitsanav@gmail.com> Co-Authored-By: 4dsherwood <4dsherwood@users.noreply.github.com>
- Loading branch information
1 parent
bcba3ba
commit 6f9dc65
Showing
6 changed files
with
114 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
|
||
class InlineOptions: | ||
|
||
@staticmethod | ||
def automatic(): | ||
from approvaltests.namer.inline_python_reporter import InlinePythonReporter | ||
from approvaltests.reporters import ReporterThatAutomaticallyApproves | ||
|
||
class AutomaticInlineOptions(InlineOptions): | ||
def apply(self, options: "Options") -> "Options": | ||
return options.with_reporter(InlinePythonReporter(ReporterThatAutomaticallyApproves())) | ||
return AutomaticInlineOptions() | ||
|
||
@staticmethod | ||
def semi_automatic(): | ||
from approvaltests.namer.inline_python_reporter import InlinePythonReporter | ||
from approvaltests.reporters import ReporterThatAutomaticallyApproves | ||
|
||
class SemiAutomaticInlineOptions(InlineOptions): | ||
def apply(self, options: "Options") -> "Options": | ||
return options.with_reporter(InlinePythonReporter(ReporterThatAutomaticallyApproves(), add_approval_line=True)) | ||
return SemiAutomaticInlineOptions() | ||
|
||
@staticmethod | ||
def applesauce(): | ||
return InlineOptions() | ||
def apply(self, options: "Options") -> "Options": | ||
|
||
return options | ||
|
||
@staticmethod | ||
def show_code(do_show_code: bool = True): | ||
from approvaltests.namer.inline_python_reporter import InlinePythonReporter | ||
|
||
class ShowCodeInlineOptions(InlineOptions): | ||
def apply(self, options: "Options") -> "Options": | ||
return options.with_reporter(InlinePythonReporter(options.reporter)) | ||
class DoNotShowCodeInlineOptions(InlineOptions): | ||
def apply(self, options: "Options") -> "Options": | ||
return options | ||
|
||
return ShowCodeInlineOptions() if do_show_code else DoNotShowCodeInlineOptions() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters