Example #1
0
def test_magics_lists_sanity():
    msg = "Must specify either a whitelist or a blacklist, not both."

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), whitelist=['one'], blacklist=['one'])

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), whitelist=[], blacklist=['one'])

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), whitelist=[], blacklist=[])

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), whitelist=['one'], blacklist=[])
Example #2
0
def test_magics_lists_sanity():
    msg = "Must specify either a allowlist or a denylist, not both."

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), allowlist=['one'], denylist=['one'])

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), allowlist=[], denylist=['one'])

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), allowlist=[], denylist=[])

    with pytest.raises(ValueError, match=msg):
        lint_magics(set(), allowlist=['one'], denylist=[])
Example #3
0
def test_magics(magics_whitelist, magics_blacklist, magics, expected_ret, expected_pass):
    ret, passed = lint_magics(magics, whitelist=magics_whitelist, blacklist=magics_blacklist)
    _verify(ret, passed, expected_ret, expected_pass)
Example #4
0
def test_magics(magics_allowlist, magics_denylist, magics, expected_ret,
                expected_pass):
    ret, passed = lint_magics(magics,
                              allowlist=magics_allowlist,
                              denylist=magics_denylist)
    _verify(ret, passed, expected_ret, expected_pass)