Skip to content

Commit

Permalink
Merge pull request #1772 from WadeBarnes/main
Browse files Browse the repository at this point in the history
Fix linting errors
  • Loading branch information
WadeBarnes committed Sep 2, 2022
2 parents fe50747 + 7559c4e commit 6a06237
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion indy_common/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from indy_common.util import getIndex
from indy_common.util import compose_cmd


def test_getIndex():
items = [('a', {'key1': 1}), ('b', {'key2': 2})]
getDict = itemgetter(1)
Expand All @@ -15,6 +16,7 @@ def containsKey(key):
assert 1 == getIndex(containsKey('key2'), items)
assert -1 == getIndex(containsKey('key3'), items)


@pytest.mark.parametrize(
'pkg_name,package',
[
Expand All @@ -31,15 +33,17 @@ def test_compose_cmd(pkg_name, package):
cmd = compose_cmd(['dpkg', '-s', package])
assert expected_cmd == cmd


def test_compose_cmd_allows_whitespace():
pkg_name = 'package_7 some_other_package'
expected_cmd = f'dpkg -s {pkg_name}'
cmd = compose_cmd(['dpkg', '-s', pkg_name])
assert expected_cmd == cmd


def test_compose_cmd_allows_pipe():
expected_cmd = 'dpkg --get-selections | grep -v deinstall | cut -f1'
cmd = compose_cmd(
['dpkg', '--get-selections', '|', 'grep', '-v', 'deinstall', '|', 'cut', '-f1']
)
assert expected_cmd == cmd
assert expected_cmd == cmd

0 comments on commit 6a06237

Please sign in to comment.