Skip to content

Commit ceda80f

Browse files
committed
Address linting warnings
1 parent f1a4485 commit ceda80f

8 files changed

+26
-27
lines changed

test/test_bind_names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ class LazyList:
778778
assert_namespace_tree(source, expected_namespaces)
779779

780780

781-
def test_class_namespace_undefined_nonlocal_name_disallow_rename():
781+
def test_class_namespace_undefined_nonlocal_name_disallow_rename_2():
782782
source = '''
783783
class LazyList:
784784
MyAttribute = MyNonLocal

test/test_folding.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def run_test(source, expected):
2626

2727

2828
@pytest.mark.parametrize(
29-
'source,expected', [
29+
('source', 'expected'), [
3030
('True | True', 'True'),
3131
('True | False', 'True'),
3232
('False | True', 'True'),
@@ -87,7 +87,7 @@ def test_bool(source, expected):
8787

8888

8989
@pytest.mark.parametrize(
90-
'source,expected', [
90+
('source', 'expected'), [
9191
('10 + 10', '20'),
9292
('10 + 0', '10'),
9393
('0 + 10', '10'),
@@ -116,7 +116,7 @@ def test_int(source, expected):
116116

117117

118118
@pytest.mark.parametrize(
119-
'source,expected', [
119+
('source', 'expected'), [
120120
('10/10', '10/10'),
121121
('5+5/10', '5+5/10'),
122122
('2*5/10', '10/10'),
@@ -134,7 +134,7 @@ def test_int_not_eval(source, expected):
134134

135135

136136
@pytest.mark.parametrize(
137-
'source,expected', [
137+
('source', 'expected'), [
138138
('"Hello" + "World"', '"Hello" + "World"'),
139139
('"Hello" * 5', '"Hello" * 5'),
140140
('b"Hello" + b"World"', 'b"Hello" + b"World"'),

test/test_fstring.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
'f"{1=!r:.4}"',
1313
'f"{1=:.4}"',
1414
'f"{1=!s:.4}"',
15-
'f"{1=:.4}"',
1615
'f"{1}"',
1716
'f"{1=}"',
1817
'f"{1=!s}"',

test/test_hoist_literals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def hoist(source):
2222
add_namespace(module)
2323
bind_names(module)
2424
resolve_names(module)
25-
allow_rename_locals(module, False)
26-
allow_rename_globals(module, False)
25+
allow_rename_locals(module, rename_locals=False)
26+
allow_rename_globals(module, rename_globals=False)
2727
rename_literals(module)
2828
rename(module)
2929
print(unparse(module))

test/test_match_rename.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
)
1717

1818

19-
def do_rename(source, locals, globals):
19+
def do_rename(source, allow_locals, allow_globals):
2020
# This will raise if the source file can't be parsed
2121
module = ast.parse(source, 'test_match_rename')
2222
add_namespace(module)
2323
bind_names(module)
2424
resolve_names(module)
2525

26-
allow_rename_locals(module, locals)
27-
allow_rename_globals(module, globals)
26+
allow_rename_locals(module, allow_locals)
27+
allow_rename_globals(module, allow_globals)
2828

2929
rename_literals(module)
3030
rename(module)
@@ -70,7 +70,7 @@ def C():
7070
'''
7171

7272
expected_ast = ast.parse(expected)
73-
actual_ast = do_rename(source, locals=False, globals=True)
73+
actual_ast = do_rename(source, allow_locals=False, allow_globals=True)
7474
assert_code(expected_ast, actual_ast)
7575

7676

@@ -109,7 +109,7 @@ def func(expensive_rename):
109109
'''
110110

111111
expected_ast = ast.parse(expected)
112-
actual_ast = do_rename(source, locals=True, globals=False)
112+
actual_ast = do_rename(source, allow_locals=True, allow_globals=False)
113113
assert_code(expected_ast, actual_ast)
114114

115115

@@ -142,7 +142,7 @@ def func(expensive_rename):
142142
'''
143143

144144
expected_ast = ast.parse(expected)
145-
actual_ast = do_rename(source, locals=True, globals=False)
145+
actual_ast = do_rename(source, allow_locals=True, allow_globals=False)
146146
assert_code(expected_ast, actual_ast)
147147

148148

@@ -180,7 +180,7 @@ def C(expensive_rename):
180180
'''
181181

182182
expected_ast = ast.parse(expected)
183-
actual_ast = do_rename(source, locals=False, globals=True)
183+
actual_ast = do_rename(source, allow_locals=False, allow_globals=True)
184184
assert_code(expected_ast, actual_ast)
185185

186186

@@ -213,7 +213,7 @@ def func(expensive_rename):
213213
'''
214214

215215
expected_ast = ast.parse(expected)
216-
actual_ast = do_rename(source, locals=True, globals=False)
216+
actual_ast = do_rename(source, allow_locals=True, allow_globals=False)
217217
assert_code(expected_ast, actual_ast)
218218

219219

@@ -246,7 +246,7 @@ def B(expensive_rename):
246246
'''
247247

248248
expected_ast = ast.parse(expected)
249-
actual_ast = do_rename(source, locals=False, globals=True)
249+
actual_ast = do_rename(source, allow_locals=False, allow_globals=True)
250250
assert_code(expected_ast, actual_ast)
251251

252252

@@ -303,7 +303,7 @@ class A: pass
303303
'''
304304

305305
expected_ast = ast.parse(expected)
306-
actual_ast = do_rename(source, locals=True, globals=False)
306+
actual_ast = do_rename(source, allow_locals=True, allow_globals=False)
307307
assert_code(expected_ast, actual_ast)
308308

309309

@@ -358,5 +358,5 @@ class Local: pass
358358
'''
359359

360360
expected_ast = ast.parse(expected)
361-
actual_ast = do_rename(source, locals=False, globals=True)
361+
actual_ast = do_rename(source, allow_locals=False, allow_globals=True)
362362
assert_code(expected_ast, actual_ast)

test/test_nonlocal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ def patch():
8888
# First check we understand the behavior
8989
unminified_locals = {}
9090
exec(test_code, {}, unminified_locals)
91-
assert unminified_locals['result'] == True
91+
assert unminified_locals['result'] is True
9292

9393
minified = python_minifier.minify(test_code, rename_locals=True)
9494
print(minified)
9595
minified_locals = {}
9696
exec(minified, {}, minified_locals)
97-
assert minified_locals['result'] == True
97+
assert minified_locals['result'] is True
9898

9999

100100
def test_nonlocal_import_alias():
@@ -118,10 +118,10 @@ def patch():
118118
# First check we understand the behavior
119119
unminified_locals = {}
120120
exec(test_code, {}, unminified_locals)
121-
assert unminified_locals['result'] == True
121+
assert unminified_locals['result'] is True
122122

123123
minified = python_minifier.minify(test_code, rename_locals=True)
124124
print(minified)
125125
minified_locals = {}
126126
exec(minified, {}, minified_locals)
127-
assert minified_locals['result'] == True
127+
assert minified_locals['result'] is True

test/test_rename_builtins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def do_rename(source):
1818
bind_names(module)
1919
resolve_names(module)
2020

21-
allow_rename_locals(module, True)
22-
allow_rename_globals(module, True)
21+
allow_rename_locals(module, rename_locals=True)
22+
allow_rename_globals(module, rename_globals=True)
2323

2424
rename(module)
2525

test/test_rename_locals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def rename_locals(source):
2222
bind_names(module)
2323
resolve_names(module)
2424

25-
allow_rename_locals(module, True)
26-
allow_rename_globals(module, False)
25+
allow_rename_locals(module, rename_locals=True)
26+
allow_rename_globals(module, rename_globals=False)
2727

2828
rename(module)
2929

0 commit comments

Comments
 (0)