From cd86fab9e2599f6d06e9b00fbfefcf8b3a8015c9 Mon Sep 17 00:00:00 2001 From: Sachaa-Thanasius Date: Sun, 14 Apr 2024 18:55:32 -0400 Subject: [PATCH] Fixed missing newline and removed debug code. --- jishaku/inline_import.py | 6 ------ tests/test_inline_import.py | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/jishaku/inline_import.py b/jishaku/inline_import.py index 0670cea7..481f2d09 100644 --- a/jishaku/inline_import.py +++ b/jishaku/inline_import.py @@ -163,12 +163,6 @@ def transform_source(source: typing.Union[str, ReadableBuffer]) -> str: encoding, _ = tokenize.detect_encoding(stream.readline) stream.seek(0) tokens_list = transform_tokens(tokenize.tokenize(stream.readline)) - try: - if tokens_list[1].type == tokenize.COMMENT: - import pprint - pprint.pprint(tokens_list) - except IndexError: - pass return tokenize.untokenize(tokens_list).decode(encoding) diff --git a/tests/test_inline_import.py b/tests/test_inline_import.py index 3a0de4df..4702f64d 100644 --- a/tests/test_inline_import.py +++ b/tests/test_inline_import.py @@ -206,9 +206,10 @@ def test_bytes_input() -> None: code = compile(tree, "", "eval") assert eval(code) == TYPE_CHECKING + @pytest.mark.parametrize("test_input", ["# comment here", "print('hello')\n# comment at end"]) def test_comments_input(test_input: str) -> None: # Check that python3.8's adding of a bad NEWLINE token is accounted for when code ends with a comment and no newline. tree = inline_import.parse(test_input, "", mode="exec") code = compile(tree, "", "exec") - eval(code, None, None) \ No newline at end of file + eval(code, None, None)