Skip to content

Commit 9ca5a14

Browse files
committed
Fix various py26 unit test failures
1 parent d6ee7c7 commit 9ca5a14

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ nosetests.xml
4444

4545
# PyCharm
4646
.idea
47+
48+
# Generated test file
49+
mytempfile.py

Diff for: src/libfuturize/fixes/fix_division_safe.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ def match(self, node):
9292
else:
9393
children.append(child.clone())
9494
if matched:
95-
return Node(node.type, children, fixers_applied=node.fixers_applied)
95+
# In Python 2.6, `Node` does not have the fixers_applied attribute
96+
# https://github.com/python/cpython/blob/8493c0cd66cfc181ac1517268a74f077e9998701/Lib/lib2to3/pytree.py#L235
97+
if hasattr(Node, "fixers_applied"):
98+
return Node(node.type, children, fixers_applied=node.fixers_applied)
99+
else:
100+
return Node(node.type, children)
96101

97102
return False
98103

Diff for: tests/test_future/test_futurize.py

+1
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ def test_import_builtins(self):
436436
"""
437437
self.convert_check(before, after, ignore_imports=False, run=False)
438438

439+
@expectedFailurePY26
439440
def test_input_without_import(self):
440441
before = """
441442
a = input()

0 commit comments

Comments
 (0)