Skip to content

bpython.test.test_interpreter.TestInterpreter.test_syntaxerror fails (bpython 0.22.1) #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mcepl opened this issue Feb 2, 2022 · 2 comments
Labels
Milestone

Comments

@mcepl
Copy link

mcepl commented Feb 2, 2022

When packaging 0.22.1 for openSUSE I get this failure in the test suite run:

[   28s] ======================================================================
[   28s] FAIL: test_syntaxerror (bpython.test.test_interpreter.TestInterpreter)
[   28s] ----------------------------------------------------------------------
[   28s] Traceback (most recent call last):
[   28s]   File "/home/abuild/rpmbuild/BUILD/bpython-0.22.1/bpython/test/test_interpreter.py", line 87, in test_syntaxerror
[   28s]     self.assertMultiLineEqual(str(plain("").join(a)), str(expected))
[   28s] AssertionError: '  Fi[92 chars]n       ^^\n\x1b[31m\x1b[1mSyntaxError\x1b[0m\[37 chars]9m\n' != '  Fi[92 chars]n    ^^^^^\n\x1b[31m\x1b[1mSyntaxError\x1b[0m\[66 chars]9m\n'
[   28s]     File "<bpython-input-148>", line 1
[   28s]       1.1.1.1
[   28s] -        ^^
[   28s] +     ^^^^^
[   28s] - SyntaxError: invalid syntax
[   28s] + SyntaxError: invalid syntax. Perhaps you forgot a comma?
[   28s] ?                                                   +++++++++++++++++++++++++++++
[   28s] 
[   28s] 
[   28s] ----------------------------------------------------------------------
[   28s] Ran 321 tests in 2.776s
[   28s] 
[   28s] FAILED (failures=1, skipped=20, expected failures=3)
[   28s] tmp6b65mybw
[   28s] tmpmoudgnm3
[   28s] 
[   28s] import inspect
[   28s] 
[   28s] class TestCls:
[   28s]     # A class with boring __init__ typing
[   28s]     def __init__(self, *args, **kwargs):
[   28s]         pass
[   28s]     # But that uses super exotic typings recognized by inspect.signature
[   28s]     __signature__ = inspect.Signature([
[   28s]         inspect.Parameter("apple", inspect.Parameter.POSITIONAL_ONLY),
[   28s]         inspect.Parameter("apple2", inspect.Parameter.KEYWORD_ONLY),
[   28s]         inspect.Parameter("pinetree", inspect.Parameter.KEYWORD_ONLY),
[   28s]     ])

It seems to me that this patch fixes the problem:

---
 bpython/test/test_interpreter.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/bpython/test/test_interpreter.py
+++ b/bpython/test/test_interpreter.py
@@ -41,10 +41,10 @@ class TestInterpreter(unittest.TestCase)
                 + green('"<bpython-input-148>"')
                 + ", line "
                 + bold(magenta("1"))
-                + "\n    1.1.1.1\n    ^^^^^\n"
+                + "\n    1.1.1.1\n       ^^\n"
                 + bold(red("SyntaxError"))
                 + ": "
-                + cyan("invalid syntax. Perhaps you forgot a comma?")
+                + cyan("invalid syntax")
                 + "\n"
             )
         elif (3, 8) <= sys.version_info[:2] <= (3, 9):
@sebastinas sebastinas added the bug label Feb 2, 2022
@sebastinas sebastinas added this to the release-0.23 milestone Feb 2, 2022
@sebastinas
Copy link
Contributor

That's fixed on the main branch. See the commits mentioning Python 3.10.1

@sebastinas
Copy link
Contributor

The relevant commits are fdd4ad9..4d33cc6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants