Projet

Général

Profil

0007-trivial-fix-pointless-statement-pylint-warning-52732.patch

Frédéric Péters, 04 avril 2021 17:20

Télécharger (3,21 ko)

Voir les différences:

Subject: [PATCH 07/15] trivial: fix pointless-statement pylint warning
 (#52732)

 pylint.rc              | 1 -
 tests/test_formdata.py | 5 +++++
 tests/test_formdef.py  | 1 -
 tests/test_users.py    | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)
pylint.rc
34 34
    non-parent-init-called,
35 35
    not-a-mapping,
36 36
    not-callable,
37
    pointless-statement,
38 37
    possibly-unused-variable,
39 38
    protected-access,
40 39
    raise-missing-from,
tests/test_formdata.py
860 860

  
861 861
    assert 'form_workflow_data__markers_stack' not in context.get_flat_keys()
862 862
    with pytest.raises(KeyError):
863
        # noqa pylint: disable=pointless-statement
863 864
        context['form_workflow_data__markers_stack']
864 865

  
865 866

  
......
932 933
        get_by_urlname.side_effect = KeyError
933 934

  
934 935
        with pytest.raises(KeyError):
936
            # noqa pylint: disable=pointless-statement
935 937
            context['form_var_foo_live_name']
936 938
        assert get_by_urlname.call_count == 1
937 939
        with pytest.raises(KeyError):  # repeated access, will go through cache
940
            # noqa pylint: disable=pointless-statement
938 941
            context['form_var_foo_live_name']
939 942
        assert get_by_urlname.call_count == 1
940 943
        assert 'form_var_foo_live_var_attr' not in context.get_flat_keys()
......
996 999
    # (see code for explanation)
997 1000
    manager = lazy_formdata.objects
998 1001
    with pytest.raises(TypeError):
1002
        # noqa pylint: disable=pointless-statement
999 1003
        manager['drafts']
1000 1004
    assert manager._cached_resultset is None
1001 1005

  
......
1488 1492
        assert context['form_display_name'] == formdata.get_display_name()
1489 1493
        assert context['form_var_foo_foo'] == 'bar'
1490 1494
        with pytest.raises(KeyError):
1495
            # noqa pylint: disable=pointless-statement
1491 1496
            context['form_var_xxx']
1492 1497
        assert 'bar' in context['form_var_foo_foo']
1493 1498
        assert context['form_var_foo_foo'] + 'ab' == 'barab'
tests/test_formdef.py
580 580
    formdef.fields = [
581 581
        StringField(id='1', label='Test', type='string', varname='foo'),
582 582
    ]
583
    formdef.roles
584 583
    formdef.store()
585 584

  
586 585
    formdef_id = formdef.id
tests/test_users.py
89 89
    assert user.get_formdef != 'Foo'
90 90

  
91 91
    with pytest.raises(AttributeError):
92
        # noqa pylint: disable=pointless-statement
92 93
        user.xxx
93
-