Skip to content
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

Fix various py26 unit test failures #563

Merged
merged 1 commit into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ nosetests.xml

# PyCharm
.idea

# Generated test file
mytempfile.py
7 changes: 6 additions & 1 deletion src/libfuturize/fixes/fix_division_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ def match(self, node):
else:
children.append(child.clone())
if matched:
return Node(node.type, children, fixers_applied=node.fixers_applied)
# In Python 2.6, `Node` does not have the fixers_applied attribute
# https://github.com/python/cpython/blob/8493c0cd66cfc181ac1517268a74f077e9998701/Lib/lib2to3/pytree.py#L235
if hasattr(Node, "fixers_applied"):
return Node(node.type, children, fixers_applied=node.fixers_applied)
else:
return Node(node.type, children)

return False

Expand Down
1 change: 1 addition & 0 deletions tests/test_future/test_futurize.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ def test_import_builtins(self):
"""
self.convert_check(before, after, ignore_imports=False, run=False)

@expectedFailurePY26
def test_input_without_import(self):
before = """
a = input()
Expand Down