Skip to content

Commit c9f6c73

Browse files
authored
Merge pull request PythonCharmers#563 from PythonCharmers/fix-py26-test
Fix various py26 unit test failures
2 parents f24fc8c + 9ca5a14 commit c9f6c73

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
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

src/libfuturize/fixes/fix_division_safe.py

Lines changed: 6 additions & 1 deletion
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

tests/test_future/test_futurize.py

Lines changed: 1 addition & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy