Skip to content

Commit

Permalink
Merge pull request #563 from PythonCharmers/fix-py26-test
Browse files Browse the repository at this point in the history
Fix various py26 unit test failures
  • Loading branch information
jmadler committed Jul 10, 2020
2 parents f24fc8c + 9ca5a14 commit c9f6c73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit c9f6c73

Please sign in to comment.