Skip to content

Commit

Permalink
fix(checkqa/flake8): E741 ambiguous variable name 'l'
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed May 16, 2021
1 parent 898c7c2 commit 91f677d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,14 @@ def test_report_source(runner, tmpdir, devnull):
tmpdir.join("foo/bar/test2.vim").ensure().write("echom 2")
result = runner.invoke(cli.main, ["report", "--source", ".", devnull.name])
out = result.output.splitlines()
assert any(l.startswith(fname) for l in out) # pragma: no branch
assert any(ln.startswith(fname) for ln in out) # pragma: no branch
assert out[-1].startswith("TOTAL")
assert out[-1].endswith(" 0%")
assert result.exit_code == 0

result = runner.invoke(cli.main, ["report", devnull.name, "--source", "."])
out = result.output.splitlines()
assert any(fname in l for l in out) # pragma: no branch
assert any(fname in ln for ln in out) # pragma: no branch
assert out[-1].startswith("TOTAL")
assert out[-1].endswith(" 0%")
assert result.exit_code == 0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_logging_error_causes_exception(capfd):
out, err = capfd.readouterr()

lines = err.splitlines()
assert any((l.startswith('Traceback') for l in lines)) # pragma: no branch
assert any((ln.startswith('Traceback') for ln in lines)) # pragma: no branch

if not lines[-1].startswith('Logged from file test_logging.py, line '):
assert lines[-2:] == [
Expand Down
40 changes: 20 additions & 20 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_profile_parse_dict_function():
assert s.mapped_dict_functions == {3}

assert len(s.lines) == 13
assert [l.line for l in s.lines.values()] == [
assert [ln.line for ln in s.lines.values()] == [
'" Test parsing of dict function.',
'let obj = {}',
'function! obj.dict_function(arg) abort',
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_profile_parse_dict_function_with_same_source(caplog):
assert s.mapped_dict_functions == {3, 12}

N = None
assert [(l.count, l.line) for l in s.lines.values()] == [
assert [(ln.count, ln.line) for ln in s.lines.values()] == [
(N, '" Test parsing of dict function (with same source).'),
(1, 'let obj1 = {}'),
(1, 'function! obj1.dict_function(arg) abort'),
Expand Down Expand Up @@ -242,7 +242,7 @@ def test_profile_parse_dict_function_with_continued_lines():
assert s.mapped_dict_functions == {3}

N = None
assert [(l.count, l.line) for l in s.lines.values()] == [
assert [(ln.count, ln.line) for ln in s.lines.values()] == [
(N, '" Test parsing of dict function with continued lines.'),
(1, 'let obj = {}'),
(1, 'function! obj.dict_function(arg) abort'),
Expand Down Expand Up @@ -270,7 +270,7 @@ def test_profile_continued_lines():
assert len(p.scripts) == 1
s = p.scripts[0]

assert [(l.count, l.line) for l in s.lines.values()] == [
assert [(ln.count, ln.line) for ln in s.lines.values()] == [
(1, 'echom 1'),
(1, 'echom 2'),
(1, ' \\ 3'),
Expand All @@ -290,7 +290,7 @@ def test_conditional_functions():
s = p.scripts[0]

N = None
assert [(l.count, l.line) for l in s.lines.values()] == [
assert [(ln.count, ln.line) for ln in s.lines.values()] == [
(N, '" Test for detection of conditional functions.'),
(N, ''),
(1, 'if 0'),
Expand Down Expand Up @@ -332,7 +332,7 @@ def test_merged_profiles():

N = None
s_fname = '/test_plugin/merged_profiles.vim'
assert [(l.count, l.line) for lnum, l in m.lines[s_fname].items()] == [
assert [(ln.count, ln.line) for lnum, ln in m.lines[s_fname].items()] == [
(N, '" Generate profile output for merged profiles.'),
(N, '" Used merged_profiles-init.vim'),
(2, "if !exists('s:conditional')"),
Expand Down Expand Up @@ -374,13 +374,13 @@ def test_mergedprofiles_fixes_line_count():

script = p.scripts[0]

assert [(l.count, l.line) for l in script.lines.values()] == [
assert [(ln.count, ln.line) for ln in script.lines.values()] == [
(None, 'let foo = 1'),
(1, 'let bar = 2'),
]

m = MergedProfiles([p])
assert [(l.count, l.line) for l in m.lines[script.path].values()] == [
assert [(ln.count, ln.line) for ln in m.lines[script.path].values()] == [
(1, 'let foo = 1'),
(1, 'let bar = 2'),
]
Expand Down Expand Up @@ -452,7 +452,7 @@ def test_function_in_function():
assert len(p.scripts) == 1
s = p.scripts[0]

assert [(l.count, l.line) for l in s.lines.values()] == [
assert [(ln.count, ln.line) for ln in s.lines.values()] == [
(None, '" Test for dict function in function.'),
(None, ''),
(1, 'function! GetObj()'),
Expand All @@ -477,7 +477,7 @@ def test_function_in_function_count(caplog):
assert len(p.scripts) == 1
s = p.scripts[0]

assert [(l.count, l.line) for l in s.lines.values()] == [
assert [(ln.count, ln.line) for ln in s.lines.values()] == [
(None, '" Test for line count with inner functions.'),
(1, 'function! Outer()'),
(None, ' " comment1'),
Expand All @@ -499,8 +499,8 @@ def test_function_in_function_with_ref(caplog):
assert len(p.scripts) == 1
s = p.scripts[0]

assert [(l.count, l.line) for l in s.lines.values()
if not l.line.startswith('"')] == [
assert [(ln.count, ln.line) for ln in s.lines.values()
if not ln.line.startswith('"')] == [
(None, ''),
(1, 'let g:refs = []'),
(None, ''),
Expand Down Expand Up @@ -548,9 +548,9 @@ def test_duplicate_s_function(caplog):
assert len(p.scripts) == 2

N = None
assert [(l.count, l.line)
for l in p.scripts[0].lines.values()
if not l.line.startswith('"')] == [
assert [(ln.count, ln.line)
for ln in p.scripts[0].lines.values()
if not ln.line.startswith('"')] == [
(1, 'function! s:function(name) abort'),
(1, ' echom a:name'),
(N, 'endfunction'),
Expand All @@ -559,9 +559,9 @@ def test_duplicate_s_function(caplog):
(1, "call test_plugin#function#function('name')"),
]

assert [(l.count, l.line)
for l in p.scripts[1].lines.values()
if not l.line.startswith('"')] == [
assert [(ln.count, ln.line)
for ln in p.scripts[1].lines.values()
if not ln.line.startswith('"')] == [
(1, 'function! s:function(name) abort'),
(1, ' echom a:name'),
(N, 'endfunction'),
Expand Down Expand Up @@ -628,8 +628,8 @@ def test_handles_unmatched_defined(platform, defined_format, defined_lnum, caplo
assert len(p.scripts) == 1
s = p.scripts[0]

assert [(l.count, l.line) for l in s.lines.values()
if not l.line.startswith('"')] == [
assert [(ln.count, ln.line) for ln in s.lines.values()
if not ln.line.startswith('"')] == [
(1, 'execute "function! F_via_execute_1()\\nreturn 0\\nendfunction"'),
(1, 'call F_via_execute_1()'),
(1, 'call F_via_execute_1()'),
Expand Down

0 comments on commit 91f677d

Please sign in to comment.