From 97b1bd9d613faa3f8b86dd0b8bc3252e6d36a315 Mon Sep 17 00:00:00 2001 From: Axel Voitier Date: Sat, 3 Jul 2021 22:34:55 +0200 Subject: [PATCH] QA: Remove NotImplementedError() lines in abstract methods from coverage --- lookups/generic_lookup.py | 18 +++++++++--------- lookups/instance_content.py | 8 ++++---- lookups/lookup.py | 24 ++++++++++++------------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lookups/generic_lookup.py b/lookups/generic_lookup.py index c7bb526..86d1cda 100644 --- a/lookups/generic_lookup.py +++ b/lookups/generic_lookup.py @@ -349,7 +349,7 @@ def begin_transaction(self, ensure: int) -> Transaction: * >= 0: the amount of objects at the end :return: A transaction object ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def end_transaction(self, transaction: Transaction) -> Iterable[GLResult]: @@ -359,7 +359,7 @@ def end_transaction(self, transaction: Transaction) -> Iterable[GLResult]: :param transaction: The transaction object. :return: The results affected by a change. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def lookup(self, cls: Type[object]) -> Iterable[Pair]: @@ -369,7 +369,7 @@ def lookup(self, cls: Type[object]) -> Iterable[Pair]: :param cls: The class to search for. :return: Iterable of Item ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def register_result(self, result: GLResult) -> None: @@ -378,11 +378,11 @@ def register_result(self, result: GLResult) -> None: :param result: The new result to remember. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def find_result(self, cls: Type[object]) -> Optional[GLResult]: - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover class Transaction(ABC): @@ -397,7 +397,7 @@ def add(self, pair: Pair) -> bool: :return: True if the Item has been added for the first time or False if some other item equal to this one already existed in the lookup ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def remove(self, pair: Pair) -> None: @@ -406,7 +406,7 @@ def remove(self, pair: Pair) -> None: :param item: Item to remove. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def set_all(self, pairs: Collection[Pair]) -> None: @@ -415,7 +415,7 @@ def set_all(self, pairs: Collection[Pair]) -> None: :param pairs: The collection of class/instance pairs. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def new_content(self, prev: Collection[Pair]) -> Tuple[Collection[Pair], Set[Pair]]: @@ -425,4 +425,4 @@ def new_content(self, prev: Collection[Pair]) -> Tuple[Collection[Pair], Set[Pai :param prev: The previous content. :return: Tuple of new content, set of changes. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover diff --git a/lookups/instance_content.py b/lookups/instance_content.py index 8a5eb08..1c1fb9d 100644 --- a/lookups/instance_content.py +++ b/lookups/instance_content.py @@ -111,7 +111,7 @@ def convert(self, obj: object) -> object: :param obj: The registered object. :return: The object converted from this object. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def type(self, obj: object) -> Type[object]: @@ -124,7 +124,7 @@ def type(self, obj: object) -> Type[object]: :return: The class that will be produced from this object (class or superclass of convert(obj)) ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def id(self, obj: object) -> str: @@ -136,7 +136,7 @@ def id(self, obj: object) -> str: :param obj: The registered object. :return: The ID for the object. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def display_name(self, obj: object) -> str: @@ -148,7 +148,7 @@ def display_name(self, obj: object) -> str: :param obj: The registered object. :return: The name representing the object for the user. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover class SimpleItem(LookupItem, Pair): diff --git a/lookups/lookup.py b/lookups/lookup.py index e632c60..ed592d4 100644 --- a/lookups/lookup.py +++ b/lookups/lookup.py @@ -56,7 +56,7 @@ def lookup(self, cls: Type[object]) -> Optional[object]: :param cls: Class or type of the object we are searching for. :return: An object implementing the given type or None if no such implementation is found. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover def __call__(self, cls: Type[object]) -> Optional[object]: return self.lookup(cls) @@ -72,7 +72,7 @@ def lookup_result(self, cls: Type[object]) -> Result: :param cls: Class or type of the objects we are searching for. :return: A live object representing instances of that type. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover def lookup_item(self, cls: Type[object]) -> Optional[Item]: ''' @@ -121,7 +121,7 @@ def get_display_name(self) -> str: :return: The string suitable for presenting the object to a user. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def get_id(self) -> str: @@ -135,7 +135,7 @@ def get_id(self) -> str: :return: A string ID of the item. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def get_instance(self) -> Optional[object]: @@ -144,7 +144,7 @@ def get_instance(self) -> Optional[object]: :return: The instance or None if the instance cannot be created. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def get_type(self) -> Type[object]: @@ -153,7 +153,7 @@ def get_type(self) -> Type[object]: :return: The class of the item. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover def __str__(self) -> str: '''Show ID for debugging.''' @@ -182,7 +182,7 @@ def result_changed(self, result: Result) -> None: ... :param listener: The listener to add. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def remove_lookup_listener(self, listener: Callable[[Result], None]) -> None: @@ -191,7 +191,7 @@ def remove_lookup_listener(self, listener: Callable[[Result], None]) -> None: :param listener: The listener to remove. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def all_classes(self) -> AbstractSet[Type[object]]: @@ -203,7 +203,7 @@ def all_classes(self) -> AbstractSet[Type[object]]: :return: Immutable set of class objects. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def all_instances(self) -> Sequence[object]: @@ -212,7 +212,7 @@ def all_instances(self) -> Sequence[object]: :return: Immutable sequence of all instances. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover @abstractmethod def all_items(self) -> Sequence[Item]: @@ -223,7 +223,7 @@ def all_items(self) -> Sequence[Item]: :return: Immutable sequence of Item. ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover class LookupProvider(ABC): @@ -239,4 +239,4 @@ def get_lookup(self) -> Lookup: :return: Fully initialized lookup instance provided by this object ''' - raise NotImplementedError() + raise NotImplementedError() # pragma: no cover