-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Test failure in Python 3.6.3 #89
Comments
Thanks for the report. I think the cause of both failures is f-strings. We probably miss some cases when we implement it. Also, did you get any output from Lines 150 to 151 in 68fbf65
|
Hrm, didn't see that.
That's all I found besides other INFO entries. |
Thanks! I'll check what's wrong with 3.6.3 this weekend. |
How do I reproduce this? For me all tests pass $ python3.6 -m nose -v
test_annassign (tests.test_code_gen.CodegenTestCase) ... ok
[...]
test_codegen_from_root (tests.test_misc.PublicAPITestCase) ... ok
test_convert_stdlib (tests.test_rtrip.RtripTestCase) ... ok
----------------------------------------------------------------------
Ran 34 tests in 18.100s
OK The same happens when running via tox: $ tox -e py36
py36 develop-inst-noop: /home/lukoa/repos/astor
py36 installed: -e git+git@github.com:radomirbosak/astor.git@b47718fa095e456c064d3d222f296fccfe36266b#egg=astor,nose==1.3.7
py36 runtests: PYTHONHASHSEED='2587239569'
py36 runtests: commands[0] | nosetests -v --nocapture
test_annassign (tests.test_code_gen.CodegenTestCase) ... ok
[...]
test_codegen_from_root (tests.test_misc.PublicAPITestCase) ... ok
test_convert_stdlib (tests.test_rtrip.RtripTestCase) ... ok
----------------------------------------------------------------------
Ran 34 tests in 16.442s
OK
__________________________________ summary ___________________________________
py36: commands succeeded
congratulations :) |
@radomirbosak, thank you for trying to reproduce this! Do you have the latest 3.6 release? (If you have 3.6.5 installed with stdlib tests and IDLE installed, I think we can close this as outdated) Note that almost all distros don't include stdlib tests and don't install IDLE by default. So you may want to check whether |
I'm still getting this in 3.6.5 - besides one more missing item:
|
The only change that we made to I think there is an escaping issue here. Here's a simple test case: def test_issue_89(self):
source = """
x = f'{host}\\n\\t{port}\\n'
"""
self.assertSrcRoundtripsGtVer(source, (3, 6)) Test result: ======================================================================
FAIL: test_issue_89 (tests.test_code_gen.CodegenTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/berker/projects/astor/tests/test_code_gen.py", line 414, in test_issue_89
self.assertSrcRoundtripsGtVer(source, (3, 6))
File "/home/berker/projects/astor/tests/test_code_gen.py", line 74, in assertSrcRoundtripsGtVer
self.assertSrcRoundtrips(source)
File "/home/berker/projects/astor/tests/test_code_gen.py", line 62, in assertSrcRoundtrips
self.assertEqual(self.to_source(ast.parse(srctxt)).rstrip(), srctxt)
AssertionError: "x = \nf'{host}\\n\\t{port}'" != "x = f'{host}\\n\\t{port}\\n'" Also, if I drop the trailing source = """
x = f'{host}\\n\\t{port}'
""" @radomirbosak would you like to work on this? |
@berkerpeksag I can take a look. After installing the stdlib tests and idle packages I was able to reproduce the issue (on python 3.6.5). |
If an f-string was ended with a newline character (more precisely, if the last element of a JoinedStr node was just a newline character), its round-trip source code representation would have an extra newline on a wrong place, resulting in invalid syntax. The bug affects only python>=3.6 (f-strings weren't supported before) This commit fixes the aforementioned bug. Fixes berkerpeksag#89.
If an f-string was ended with a newline character (more precisely, if the last element of a JoinedStr node was just a newline character), its round-trip source code representation would have an extra newline on a wrong place, resulting in invalid syntax. The bug affects only python>=3.6 (f-strings weren't supported before) This commit fixes the aforementioned bug. Fixes berkerpeksag#89.
If an f-string was ended with a newline character (more precisely, if the last element of a JoinedStr node was just a newline character), its round-trip source code representation would have an extra newline on a wrong place, resulting in invalid syntax. The bug affects only python>=3.6 (f-strings weren't supported before) This commit fixes the aforementioned bug. Fixes berkerpeksag#89.
If an f-string was ended with a newline character (more precisely, if the last element of a JoinedStr node was just a newline character), its round-trip source code representation would have an extra newline on a wrong place, resulting in invalid syntax. The bug affects only python>=3.6 (f-strings weren't supported before) This commit fixes the aforementioned bug. Fixes berkerpeksag#89.
If an f-string was ended with a newline character (more precisely, if the last element of a JoinedStr node was just a newline character), its round-trip source code representation would have an extra newline on a wrong place, resulting in invalid syntax. The bug affects only python>=3.6 (f-strings weren't supported before) This commit fixes the aforementioned bug. This commit also replaces pypy3.3-5.2-alpha1 tox/travis with pypy3.5. The former PyPy version has a bug causing the tests to fail: https://bitbucket.org/pypy/pypy/issues/2316/osget_terminal_size-is-missing-on-pypy3-hg Fixes #89.
Looks like a test-only failure, though.
The text was updated successfully, but these errors were encountered: