trivial: fix pointless-statement pylint warning (#52732)

This commit is contained in:
Frédéric Péters 2021-04-02 22:47:22 +02:00
parent e35c293dcb
commit 7a9657c293
4 changed files with 6 additions and 2 deletions

View File

@ -34,7 +34,6 @@ disable=
non-parent-init-called,
not-a-mapping,
not-callable,
pointless-statement,
possibly-unused-variable,
protected-access,
raise-missing-from,

View File

@ -860,6 +860,7 @@ def test_lazy_formdata_workflow_data(pub):
assert 'form_workflow_data__markers_stack' not in context.get_flat_keys()
with pytest.raises(KeyError):
# noqa pylint: disable=pointless-statement
context['form_workflow_data__markers_stack']
@ -932,9 +933,11 @@ def test_lazy_formdata_live_item(pub):
get_by_urlname.side_effect = KeyError
with pytest.raises(KeyError):
# noqa pylint: disable=pointless-statement
context['form_var_foo_live_name']
assert get_by_urlname.call_count == 1
with pytest.raises(KeyError): # repeated access, will go through cache
# noqa pylint: disable=pointless-statement
context['form_var_foo_live_name']
assert get_by_urlname.call_count == 1
assert 'form_var_foo_live_var_attr' not in context.get_flat_keys()
@ -996,6 +999,7 @@ def test_lazy_formdata_queryset(pub, variable_test_data):
# (see code for explanation)
manager = lazy_formdata.objects
with pytest.raises(TypeError):
# noqa pylint: disable=pointless-statement
manager['drafts']
assert manager._cached_resultset is None
@ -1488,6 +1492,7 @@ def test_lazy_variables(pub, variable_test_data):
assert context['form_display_name'] == formdata.get_display_name()
assert context['form_var_foo_foo'] == 'bar'
with pytest.raises(KeyError):
# noqa pylint: disable=pointless-statement
context['form_var_xxx']
assert 'bar' in context['form_var_foo_foo']
assert context['form_var_foo_foo'] + 'ab' == 'barab'

View File

@ -580,7 +580,6 @@ def test_pickle_2to3_conversion(pub):
formdef.fields = [
StringField(id='1', label='Test', type='string', varname='foo'),
]
formdef.roles
formdef.store()
formdef_id = formdef.id

View File

@ -89,4 +89,5 @@ def test_user_formdef_getattr():
assert user.get_formdef != 'Foo'
with pytest.raises(AttributeError):
# noqa pylint: disable=pointless-statement
user.xxx