Skip to content

Commit

Permalink
Use is to check enums
Browse files Browse the repository at this point in the history
  • Loading branch information
ducminh-phan committed Nov 20, 2022
1 parent e788877 commit 3a46570
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions reformat_gherkin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def reformat(src: Tuple[str], report: Report, *, options: Options):


def reformat_stdin(*, options: Options) -> bool:
output = sys.stdout.buffer if options.write_back == WriteBackMode.INPLACE else None
output = sys.stdout.buffer if options.write_back is WriteBackMode.INPLACE else None
return reformat_stream_or_path(
sys.stdin.buffer,
output,
Expand All @@ -73,7 +73,7 @@ def reformat_stdin(*, options: Options) -> bool:


def reformat_single_file(path: Path, *, options: Options) -> bool:
out_path = path if options.write_back == WriteBackMode.INPLACE else None
out_path = path if options.write_back is WriteBackMode.INPLACE else None
return reformat_stream_or_path(path, out_path, options=options)


Expand Down
8 changes: 4 additions & 4 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ def make_options(

def options_to_cli_args(options):
return [
"" if options.write_back == WriteBackMode.INPLACE else "--check",
"" if options.write_back is WriteBackMode.INPLACE else "--check",
""
if options.step_keyword_alignment == AlignmentMode.NONE
if options.step_keyword_alignment is AlignmentMode.NONE
else f"--alignment {options.step_keyword_alignment.value}",
""
if options.newline == NewlineMode.KEEP
if options.newline is NewlineMode.KEEP
else f"--newline {options.newline.value}",
"--fast" if options.fast else "--safe",
"--single-line-tags"
if options.tag_line_mode == TagLineMode.SINGLELINE
if options.tag_line_mode is TagLineMode.SINGLELINE
else "--multi-line-tags",
"--use-tabs"
if options.indent == "\t"
Expand Down

0 comments on commit 3a46570

Please sign in to comment.