Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dbdf029

Browse files
committed
remove fix_callable - callable() was readded many releases ago.
1 parent 6a294a5 commit dbdf029

2 files changed

Lines changed: 0 additions & 129 deletions

File tree

Lib/lib2to3/fixes/fix_callable.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

Lib/lib2to3/tests/test_fixers.py

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,98 +2920,6 @@ def test_native_unicode_literal_escape_u(self):
29202920
a = f + r"""r'\\\u20ac\U0001d121\\u20ac'"""
29212921
self.check(b, a)
29222922

2923-
class Test_callable(FixerTestCase):
2924-
fixer = "callable"
2925-
2926-
def test_prefix_preservation(self):
2927-
b = """callable( x)"""
2928-
a = """import collections\nisinstance( x, collections.Callable)"""
2929-
self.check(b, a)
2930-
2931-
b = """if callable(x): pass"""
2932-
a = """import collections
2933-
if isinstance(x, collections.Callable): pass"""
2934-
self.check(b, a)
2935-
2936-
def test_callable_call(self):
2937-
b = """callable(x)"""
2938-
a = """import collections\nisinstance(x, collections.Callable)"""
2939-
self.check(b, a)
2940-
2941-
def test_global_import(self):
2942-
b = """
2943-
def spam(foo):
2944-
callable(foo)"""[1:]
2945-
a = """
2946-
import collections
2947-
def spam(foo):
2948-
isinstance(foo, collections.Callable)"""[1:]
2949-
self.check(b, a)
2950-
2951-
b = """
2952-
import collections
2953-
def spam(foo):
2954-
callable(foo)"""[1:]
2955-
# same output if it was already imported
2956-
self.check(b, a)
2957-
2958-
b = """
2959-
from collections import *
2960-
def spam(foo):
2961-
callable(foo)"""[1:]
2962-
a = """
2963-
from collections import *
2964-
import collections
2965-
def spam(foo):
2966-
isinstance(foo, collections.Callable)"""[1:]
2967-
self.check(b, a)
2968-
2969-
b = """
2970-
do_stuff()
2971-
do_some_other_stuff()
2972-
assert callable(do_stuff)"""[1:]
2973-
a = """
2974-
import collections
2975-
do_stuff()
2976-
do_some_other_stuff()
2977-
assert isinstance(do_stuff, collections.Callable)"""[1:]
2978-
self.check(b, a)
2979-
2980-
b = """
2981-
if isinstance(do_stuff, Callable):
2982-
assert callable(do_stuff)
2983-
do_stuff(do_stuff)
2984-
if not callable(do_stuff):
2985-
exit(1)
2986-
else:
2987-
assert callable(do_stuff)
2988-
else:
2989-
assert not callable(do_stuff)"""[1:]
2990-
a = """
2991-
import collections
2992-
if isinstance(do_stuff, Callable):
2993-
assert isinstance(do_stuff, collections.Callable)
2994-
do_stuff(do_stuff)
2995-
if not isinstance(do_stuff, collections.Callable):
2996-
exit(1)
2997-
else:
2998-
assert isinstance(do_stuff, collections.Callable)
2999-
else:
3000-
assert not isinstance(do_stuff, collections.Callable)"""[1:]
3001-
self.check(b, a)
3002-
3003-
def test_callable_should_not_change(self):
3004-
a = """callable(*x)"""
3005-
self.unchanged(a)
3006-
3007-
a = """callable(x, y)"""
3008-
self.unchanged(a)
3009-
3010-
a = """callable(x, kw=y)"""
3011-
self.unchanged(a)
3012-
3013-
a = """callable()"""
3014-
self.unchanged(a)
30152923

30162924
class Test_filter(FixerTestCase):
30172925
fixer = "filter"

0 commit comments

Comments
 (0)