Skip to content

Commit c011c49

Browse files
committed
Linting
1 parent 74747a8 commit c011c49

File tree

4 files changed

+37
-28
lines changed

4 files changed

+37
-28
lines changed

domdf_python_tools/import_tools.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ def discover(
6868
matched_classes = list()
6969

7070
for _, module_name, _ in pkgutil.walk_packages(
71-
# https://github.com/python/mypy/issues/1422
72-
# Stalled PRs: https://github.com/python/mypy/pull/3527
73-
# https://github.com/python/mypy/pull/5212
74-
package.__path__, # type: ignore
75-
prefix=package.__name__ + '.',
76-
):
71+
# https://github.com/python/mypy/issues/1422
72+
# Stalled PRs: https://github.com/python/mypy/pull/3527
73+
# https://github.com/python/mypy/pull/5212
74+
package.__path__, # type: ignore
75+
prefix=package.__name__ + '.',
76+
):
7777
module = __import__(module_name, fromlist=['__trash'], level=0)
7878

7979
# Check all the functions in that module

tests/discover_demo_module/submodule_a.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ def foo():
33

44

55
def bar():
6-
pass
6+
pass
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
from string import ascii_letters
1+
# stdlib
22
from math import ceil
3+
from string import ascii_letters
4+
35

46
class Bob():
57
pass
68

79

810
class Alice():
9-
pass
11+
pass

tests/test_import_tools.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
sys.path.append(".")
1313
sys.path.append("tests")
1414

15-
# 3rd partys
15+
# 3rd party
1616
import discover_demo_module
1717

1818

@@ -28,18 +28,22 @@ def test_discover():
2828

2929
def test_discover_function_only():
3030
# Alphabetical order regardless of order in the module.
31-
assert discover(discover_demo_module, match_func=inspect.isfunction) == [
32-
discover_demo_module.submodule_a.bar,
33-
discover_demo_module.submodule_a.foo,
34-
]
31+
assert discover(
32+
discover_demo_module, match_func=inspect.isfunction
33+
) == [
34+
discover_demo_module.submodule_a.bar,
35+
discover_demo_module.submodule_a.foo,
36+
]
3537

3638

3739
def test_discover_class_only():
3840
# Alphabetical order regardless of order in the module.
39-
assert discover(discover_demo_module, match_func=inspect.isclass) == [
40-
discover_demo_module.submodule_b.Alice,
41-
discover_demo_module.submodule_b.Bob,
42-
]
41+
assert discover(
42+
discover_demo_module, match_func=inspect.isclass
43+
) == [
44+
discover_demo_module.submodule_b.Alice,
45+
discover_demo_module.submodule_b.Bob,
46+
]
4347

4448

4549
def test_discover_hasattr():
@@ -74,16 +78,19 @@ def raises_attribute_error(obj, **kwargs):
7478
)
7579

7680

77-
@pytest.mark.parametrize("obj, expects", [
78-
raises_attribute_error("abc", id="string"),
79-
raises_attribute_error(123, id="int"),
80-
raises_attribute_error(12.34, id="float"),
81-
raises_attribute_error([1, 2, 3], id="list"),
82-
raises_attribute_error((1, 2, 3), id="tuple"),
83-
raises_attribute_error({1, 2, 3}, id="set"),
84-
raises_attribute_error({"a": 1, "b": 2, "c": 3}, id="dictionary"),
85-
pytest.param(HasPath, haspath_error, id="HasPath"),
86-
])
81+
@pytest.mark.parametrize(
82+
"obj, expects",
83+
[
84+
raises_attribute_error("abc", id="string"),
85+
raises_attribute_error(123, id="int"),
86+
raises_attribute_error(12.34, id="float"),
87+
raises_attribute_error([1, 2, 3], id="list"),
88+
raises_attribute_error((1, 2, 3), id="tuple"),
89+
raises_attribute_error({1, 2, 3}, id="set"),
90+
raises_attribute_error({"a": 1, "b": 2, "c": 3}, id="dictionary"),
91+
pytest.param(HasPath, haspath_error, id="HasPath"),
92+
]
93+
)
8794
def test_discover_errors(obj, expects):
8895
with expects:
8996
discover(obj)

0 commit comments

Comments
 (0)