Skip to content

Commit

Permalink
Merge pull request #28 from AWhetter/fix_long_argname
Browse files Browse the repository at this point in the history
Fixed long getting converted to int when used as a keyword argument
  • Loading branch information
amyreese committed Nov 12, 2020
2 parents c52d218 + c158164 commit a67281e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fissix/fixer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def is_probably_builtin(node):
# Assignment.
return False
if parent.type == syms.parameters or (
parent.type == syms.typedargslist
parent.type in (syms.typedargslist, syms.argument)
and (
(prev is not None and prev.type == token.COMMA)
or parent.children[0] is node
Expand Down
8 changes: 8 additions & 0 deletions fissix/tests/test_fixers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,11 @@ def test_3(self):
a = """z = type(x) in (int, int)"""
self.check(b, a)

def test_4(self):
b = """f(arg=long)"""
a = """f(arg=int)"""
self.check(b, a)

def test_unchanged(self):
s = """long = True"""
self.unchanged(s)
Expand All @@ -1207,6 +1212,9 @@ def test_unchanged(self):
s = """def f(x, long=True): pass"""
self.unchanged(s)

s = """f(long=True)"""
self.unchanged(s)

def test_prefix_preservation(self):
b = """x = long( x )"""
a = """x = int( x )"""
Expand Down

0 comments on commit a67281e

Please sign in to comment.