Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Aug 1, 2024
1 parent 0998679 commit d1789dd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/test_tokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_fstring() -> None:
'f"x"',
[
Token("FSTRING_START", 'f"', (1, 0), (1, 2)),
Token("FSTRING_MIDDLE", 'x', (1, 2), (1, 3)),
Token("FSTRING_MIDDLE", "x", (1, 2), (1, 3)),
Token("FSTRING_END", '"', (1, 3), (1, 4)),
Token("ENDMARKER", "", (2, 0), (2, 0)),
],
Expand All @@ -69,11 +69,11 @@ def test_fstring() -> None:
'f"{x}"',
[
Token("FSTRING_START", 'f"', (1, 0), (1, 2)),
Token("FSTRING_MIDDLE", '', (1, 2), (1, 2)),
Token("LBRACE", '{', (1, 2), (1, 3)),
Token("FSTRING_MIDDLE", "", (1, 2), (1, 2)),
Token("LBRACE", "{", (1, 2), (1, 3)),
Token("NAME", "x", (1, 3), (1, 4)),
Token("RBRACE", '}', (1, 4), (1, 5)),
Token("FSTRING_MIDDLE", '', (1, 5), (1, 5)),
Token("RBRACE", "}", (1, 4), (1, 5)),
Token("FSTRING_MIDDLE", "", (1, 5), (1, 5)),
Token("FSTRING_END", '"', (1, 5), (1, 6)),
Token("ENDMARKER", "", (2, 0), (2, 0)),
],
Expand Down Expand Up @@ -110,9 +110,10 @@ def test_fstring() -> None:
)


# Run "echo some code | python tests/test_tokenize.py" to generate test cases.
if __name__ == "__main__":
code = sys.stdin.read()
tokens = get_tokens(code)
text = f"assert_tokenizes({code!r}, {tokens!r})"
text = black.format_str(text, mode=black.FileMode())
text = black.format_str(text, mode=black.Mode())
print(textwrap.indent(text, " "))

0 comments on commit d1789dd

Please sign in to comment.