aboutsummaryrefslogtreecommitdiff
path: root/src/suite
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-05 01:38:33 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-05 01:38:33 +0100
commita3e983f78dc4cbcf6f75f78fa2b3c57e09cd1b2b (patch)
tree41e580d778fce9baa00dd3850b8cf79b9ac820e9 /src/suite
parente3fd7b2f1de32dfedce03470571f383b407096cb (diff)
downloadminishell_test-a3e983f78dc4cbcf6f75f78fa2b3c57e09cd1b2b.tar.gz
minishell_test-a3e983f78dc4cbcf6f75f78fa2b3c57e09cd1b2b.tar.bz2
minishell_test-a3e983f78dc4cbcf6f75f78fa2b3c57e09cd1b2b.zip
Added a few flake8 plugin
Diffstat (limited to 'src/suite')
-rw-r--r--src/suite/decorator.py9
-rw-r--r--src/suite/suite.py10
2 files changed, 11 insertions, 8 deletions
diff --git a/src/suite/decorator.py b/src/suite/decorator.py
index 87787de..fdc7fb6 100644
--- a/src/suite/decorator.py
+++ b/src/suite/decorator.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 12:28:00 by charles #+# #+# #
-# Updated: 2021/01/31 04:45:08 by charles ### ########.fr #
+# Updated: 2021/02/04 16:18:11 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -17,13 +17,16 @@ from suite import Suite
from test import Test
-def suite(groups: List[str] = [], bonus: bool = False):
+def suite(groups: List[str] = [], bonus: bool = False): # type: ignore
"""Decorator generator for suites arguments"""
def suite_wrapper(origin):
"""Decorator for a suite function (fmt: suite_[name]) """
- mod_name = inspect.getmodule(origin).__name__[len("suites."):]
+ mod = inspect.getmodule(origin)
+ if mod is None:
+ raise NotImplementedError
+ mod_name = mod.__name__[len("suites."):]
name = "{}/{}".format(mod_name, origin.__name__[len("suite_"):])
description = origin.__doc__
if description is None:
diff --git a/src/suite/suite.py b/src/suite/suite.py
index f3d58b1..836cac0 100644
--- a/src/suite/suite.py
+++ b/src/suite/suite.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:29 by charles #+# #+# #
-# Updated: 2021/01/31 04:40:22 by charles ### ########.fr #
+# Updated: 2021/02/04 16:13:08 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -28,7 +28,7 @@ class Suite:
break
@classmethod
- def setup(cls, asked_names: List[str]):
+ def setup(cls, asked_names: List[str]) -> None:
""" Remove not asked suite from available suites
Tries to autocomplete the asked names
"""
@@ -49,7 +49,7 @@ class Suite:
or n.startswith(name)]
if len(matches) == 1:
names.append(matches[0])
- elif len(matches) != 0 and all([n.startswith(name) for n in matches]):
+ elif len(matches) != 0 and all(n.startswith(name) for n in matches):
names.extend(matches)
elif len(matches) > 2:
print(("Ambiguous name `{}` match the following suites\n\t{}\n"
@@ -64,7 +64,7 @@ class Suite:
cls.available = list(set(
[s for s in cls.available if s.name in names]
- + [s for s in cls.available if any([g for g in s.groups if g in names])]
+ + [s for s in cls.available if any(g for g in s.groups if g in names)]
))
cls.available.sort(key=lambda s: s.name)
for s in cls.available:
@@ -79,7 +79,7 @@ class Suite:
@classmethod
def list(cls):
print("Groups:")
- print("\n".join(set([" - " + ', '.join(s.groups) for s in Suite.available])))
+ print("\n".join({" - " + ', '.join(s.groups) for s in Suite.available}))
print("The available suites are:")
max_name_width = max(len(s.name) for s in Suite.available) + 5
lines = [