Fix new flake8 E741 error from using `l` variable
The just-updated flake8 package hits a bunch of:
E741 ambiguous variable name 'l'
warnings. This commit renames them all from `l` to `lst` (they are all
list values) to avoid the error.
diff --git a/tests/test_opaque_types.py b/tests/test_opaque_types.py
index 2d3aef5..6b3802f 100644
--- a/tests/test_opaque_types.py
+++ b/tests/test_opaque_types.py
@@ -4,21 +4,21 @@
def test_string_list():
- l = m.StringList()
- l.push_back("Element 1")
- l.push_back("Element 2")
- assert m.print_opaque_list(l) == "Opaque list: [Element 1, Element 2]"
- assert l.back() == "Element 2"
+ lst = m.StringList()
+ lst.push_back("Element 1")
+ lst.push_back("Element 2")
+ assert m.print_opaque_list(lst) == "Opaque list: [Element 1, Element 2]"
+ assert lst.back() == "Element 2"
- for i, k in enumerate(l, start=1):
+ for i, k in enumerate(lst, start=1):
assert k == "Element {}".format(i)
- l.pop_back()
- assert m.print_opaque_list(l) == "Opaque list: [Element 1]"
+ lst.pop_back()
+ assert m.print_opaque_list(lst) == "Opaque list: [Element 1]"
cvp = m.ClassWithSTLVecProperty()
assert m.print_opaque_list(cvp.stringList) == "Opaque list: []"
- cvp.stringList = l
+ cvp.stringList = lst
cvp.stringList.push_back("Element 3")
assert m.print_opaque_list(cvp.stringList) == "Opaque list: [Element 1, Element 3]"
diff --git a/tests/test_pytypes.py b/tests/test_pytypes.py
index 94c90a9..992e7fc 100644
--- a/tests/test_pytypes.py
+++ b/tests/test_pytypes.py
@@ -7,11 +7,11 @@
def test_list(capture, doc):
with capture:
- l = m.get_list()
- assert l == ["overwritten"]
+ lst = m.get_list()
+ assert lst == ["overwritten"]
- l.append("value2")
- m.print_list(l)
+ lst.append("value2")
+ m.print_list(lst)
assert capture.unordered == """
Entry at position 0: value
list item 0: overwritten
diff --git a/tests/test_sequences_and_iterators.py b/tests/test_sequences_and_iterators.py
index 640ca07..f6c0620 100644
--- a/tests/test_sequences_and_iterators.py
+++ b/tests/test_sequences_and_iterators.py
@@ -131,9 +131,9 @@
m.iterator_to_list(iter(bad_next_call, None))
assert str(excinfo.value) == "py::iterator::advance() should propagate errors"
- l = [1, None, 0, None]
- assert m.count_none(l) == 2
- assert m.find_none(l) is True
+ lst = [1, None, 0, None]
+ assert m.count_none(lst) == 2
+ assert m.find_none(lst) is True
assert m.count_nonzeros({"a": 0, "b": 1, "c": 2}) == 2
r = range(5)
diff --git a/tests/test_stl.py b/tests/test_stl.py
index db8515e..fbf95ff 100644
--- a/tests/test_stl.py
+++ b/tests/test_stl.py
@@ -6,11 +6,11 @@
def test_vector(doc):
"""std::vector <-> list"""
- l = m.cast_vector()
- assert l == [1]
- l.append(2)
- assert m.load_vector(l)
- assert m.load_vector(tuple(l))
+ lst = m.cast_vector()
+ assert lst == [1]
+ lst.append(2)
+ assert m.load_vector(lst)
+ assert m.load_vector(tuple(lst))
assert m.cast_bool_vector() == [True, False]
assert m.load_bool_vector([True, False])
@@ -24,9 +24,9 @@
def test_array(doc):
"""std::array <-> list"""
- l = m.cast_array()
- assert l == [1, 2]
- assert m.load_array(l)
+ lst = m.cast_array()
+ assert lst == [1, 2]
+ assert m.load_array(lst)
assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
@@ -34,9 +34,9 @@
def test_valarray(doc):
"""std::valarray <-> list"""
- l = m.cast_valarray()
- assert l == [1, 4, 9]
- assert m.load_valarray(l)
+ lst = m.cast_valarray()
+ assert lst == [1, 4, 9]
+ assert m.load_valarray(lst)
assert doc(m.cast_valarray) == "cast_valarray() -> List[int]"
assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"