Skip to content

Commit

Permalink
QA: Remove NotImplementedError() lines in abstract methods from coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelVoitier committed Jul 3, 2021
1 parent 7a37190 commit 97b1bd9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
18 changes: 9 additions & 9 deletions lookups/generic_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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]:
Expand All @@ -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:
Expand All @@ -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):
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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]]:
Expand All @@ -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
8 changes: 4 additions & 4 deletions lookups/instance_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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):
Expand Down
24 changes: 12 additions & 12 deletions lookups/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]:
'''
Expand Down Expand Up @@ -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:
Expand All @@ -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]:
Expand All @@ -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]:
Expand All @@ -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.'''
Expand Down Expand Up @@ -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:
Expand All @@ -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]]:
Expand All @@ -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]:
Expand All @@ -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]:
Expand All @@ -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):
Expand All @@ -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

0 comments on commit 97b1bd9

Please sign in to comment.