Run black code formatter and flake8

This commit is contained in:
Eric Torres 2019-03-31 11:17:40 -07:00
parent 77b810b5a6
commit 4e840f675e
2 changed files with 9 additions and 6 deletions

View File

@ -28,7 +28,10 @@ class PackageManager:
:param db_path: path to the package manager database :param db_path: path to the package manager database
:type db_path: str or path-like object :type db_path: str or path-like object
:param pkglist_cmd: command to list installed packages to stdout :param pkglist_cmd: command to list installed packages to stdout
:type pkglist_cmd: list :type pkglist_cmd: str or iterable of str
:raises: TypeError if pkglist_cmd is not str or an iterable of str
:raises: ValueError if pkglist_cmd is an empty str or an iterable
containing an empty str
""" """
if not isinstance(pkglist_cmd, Iterable) or isinstance(pkglist_cmd, dict): if not isinstance(pkglist_cmd, Iterable) or isinstance(pkglist_cmd, dict):
raise TypeError("pkglist_cmd is the wrong type") raise TypeError("pkglist_cmd is the wrong type")

View File

@ -6,13 +6,13 @@ import doctest
import subprocess import subprocess
import unittest import unittest
from hypothesis import given, note from hypothesis import given
from hypothesis.strategies import ( from hypothesis.strategies import (
booleans, booleans,
dictionaries, dictionaries,
from_regex,
integers, integers,
iterables, iterables,
lists,
one_of, one_of,
none, none,
text, text,
@ -62,7 +62,7 @@ class TestCreatePackageManager(unittest.TestCase):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
PackageManager("nothing", "nothing", []) PackageManager("nothing", "nothing", [])
PackageManager("nothing", "nothing", set()) PackageManager("nothing", "nothing", set())
PackageManager("nothing", "nothing", '') PackageManager("nothing", "nothing", "")
@given(iterables(one_of(none(), booleans(), integers()), min_size=1)) @given(iterables(one_of(none(), booleans(), integers()), min_size=1))
def test_wrong_iterable_element_type(self, cmd): def test_wrong_iterable_element_type(self, cmd):
@ -71,8 +71,8 @@ class TestCreatePackageManager(unittest.TestCase):
def test_empty_str_in_iterable(self): def test_empty_str_in_iterable(self):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
PackageManager("nothing", "nothing", ['']) PackageManager("nothing", "nothing", [""])
PackageManager("nothing", "nothing", ['pacman', '']) PackageManager("nothing", "nothing", ["pacman", ""])
def tearDown(self): def tearDown(self):
self.patched_path.stop() self.patched_path.stop()