| 1 |
"""Abstract Classes and Model functions for Mutators, Runners, and Reporters.""" |
|
| 2 | ||
| 3 |
from __future__ import annotations |
|
| 4 | ||
| 5 |
import ast |
|
| 6 |
from abc import ABC, abstractmethod |
|
| 7 |
from typing import TYPE_CHECKING, Callable |
|
| 8 | ||
| 9 |
from .data import FileMutation, Mutant, MutantTrialResult, PoodleConfig, TestingResults |
|
| 10 | ||
| 11 |
if TYPE_CHECKING: |
|
| 12 |
from pathlib import Path |
|
| 13 | ||
| 14 | ||
| 15 |
def create_mutations( # type: ignore [empty-body] |
|
| 16 |
config: PoodleConfig, |
|
| 17 |
echo: Callable, |
|
| 18 |
parsed_ast: ast.Module, |
|
| 19 |
file_lines: list[str], |
|
| 20 |
*_, |
|
| 21 |
**__, |
|
| 22 |
) -> list[FileMutation]: |
|
| 23 |
"""Create a list of Mutants for the provided parsed Module. |
|
| 24 | ||
| 25 |
This will be called once with parsed ast for each Module. |
|
| 26 |
""" |
|
| 27 | ||
| 28 | ||
| 29 |
class Mutator(ABC): |
|
| 30 |
"""Abstract class for Mutators.""" |
|
| 31 | ||
| 32 |
def __init__(self, config: PoodleConfig, echo: Callable, *_, **__) -> None: |
|
| 33 |
"""Initialize PoodleMutator.""" |
|
| 34 |
self.config = config |
|
| 35 |
self.echo = echo |
|
| 36 | ||
| ▸ | 37 |
mutator_name = "" |
|
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:37
@@ -34,7 +34,7 @@
self.config = config
self.echo = echo
- mutator_name = ""
+ mutator_name = 'XXXX'
@abstractmethod
def create_mutations(self, parsed_ast: ast.Module, file_lines: list[str], *_, **__) -> list[FileMutation]:
|
||
| 38 | ||
| ▸ | 39 |
@abstractmethod |
|
Status: Mutant Found Mutator Name: Decorator Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:39
@@ -36,12 +36,7 @@
mutator_name = ""
- @abstractmethod
- def create_mutations(self, parsed_ast: ast.Module, file_lines: list[str], *_, **__) -> list[FileMutation]:
- """Create a list of Mutants for the provided parsed Module.
-
- This will be called once with parsed ast for each Module.
- """
+ @def create_mutations(self, parsed_ast: ast.Module, file_lines: list[str], *_, **__) -> list[FileMutation]:
"""Create a list of Mutants for the provided parsed Module.
This will be called once with parsed ast for each Module.
"""
@classmethod
def create_file_mutation(cls, node: ast.AST, text: str) -> FileMutation:
|
||
| 40 |
def create_mutations(self, parsed_ast: ast.Module, file_lines: list[str], *_, **__) -> list[FileMutation]: |
|
| 41 |
"""Create a list of Mutants for the provided parsed Module. |
|
| 42 | ||
| 43 |
This will be called once with parsed ast for each Module. |
|
| 44 |
""" |
|
| 45 | ||
| ▸ | 46 |
@classmethod |
|
Status: Mutant Found Mutator Name: Decorator Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:46
@@ -43,19 +43,7 @@
This will be called once with parsed ast for each Module.
"""
- @classmethod
- def create_file_mutation(cls, node: ast.AST, text: str) -> FileMutation:
- """Create a FileMutation copying location data from specified node."""
- lineno, col_offset, end_lineno, end_col_offset = cls.get_location(node)
-
- return FileMutation(
- mutator_name=cls.mutator_name,
- lineno=lineno,
- col_offset=col_offset,
- end_lineno=end_lineno,
- end_col_offset=end_col_offset,
- text=text,
- )
+ @def create_file_mutation(cls, node: ast.AST, text: str) -> FileMutation:
"""Create a FileMutation copying location data from specified node."""
lineno, col_offset, end_lineno, end_col_offset = cls.get_location(node)
return FileMutation(mutator_name=cls.mutator_name, lineno=lineno, col_offset=col_offset, end_lineno=end_lineno, end_col_offset=end_col_offset, text=text)
@staticmethod
def get_location(node: ast.AST) -> tuple[int, int, int, int]:
|
||
| 47 |
def create_file_mutation(cls, node: ast.AST, text: str) -> FileMutation: |
|
| 48 |
"""Create a FileMutation copying location data from specified node.""" |
|
| ▸ | 49 |
lineno, col_offset, end_lineno, end_col_offset = cls.get_location(node) |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:49
@@ -46,7 +46,7 @@
@classmethod
def create_file_mutation(cls, node: ast.AST, text: str) -> FileMutation:
"""Create a FileMutation copying location data from specified node."""
- lineno, col_offset, end_lineno, end_col_offset = cls.get_location(node)
+ lineno, col_offset, end_lineno, end_col_offset = None
return FileMutation(
mutator_name=cls.mutator_name,
|
||
| 50 | ||
| ▸ | 51 |
return FileMutation( |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:51
@@ -48,14 +48,7 @@
"""Create a FileMutation copying location data from specified node."""
lineno, col_offset, end_lineno, end_col_offset = cls.get_location(node)
- return FileMutation(
- mutator_name=cls.mutator_name,
- lineno=lineno,
- col_offset=col_offset,
- end_lineno=end_lineno,
- end_col_offset=end_col_offset,
- text=text,
- )
+ return None
@staticmethod
def get_location(node: ast.AST) -> tuple[int, int, int, int]:
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:51
@@ -48,14 +48,7 @@
"""Create a FileMutation copying location data from specified node."""
lineno, col_offset, end_lineno, end_col_offset = cls.get_location(node)
- return FileMutation(
- mutator_name=cls.mutator_name,
- lineno=lineno,
- col_offset=col_offset,
- end_lineno=end_lineno,
- end_col_offset=end_col_offset,
- text=text,
- )
+ return None
@staticmethod
def get_location(node: ast.AST) -> tuple[int, int, int, int]:
|
||
| 52 |
mutator_name=cls.mutator_name, |
|
| 53 |
lineno=lineno, |
|
| 54 |
col_offset=col_offset, |
|
| 55 |
end_lineno=end_lineno, |
|
| 56 |
end_col_offset=end_col_offset, |
|
| 57 |
text=text, |
|
| 58 |
) |
|
| 59 | ||
| ▸ | 60 |
@staticmethod |
|
Status: Mutant Found Mutator Name: Decorator Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:60
@@ -57,35 +57,7 @@
text=text,
)
- @staticmethod
- def get_location(node: ast.AST) -> tuple[int, int, int, int]:
- """Get location lines and columns that encompasses node and all child nodes."""
- lineno = node.lineno
- col_offset = node.col_offset
- end_lineno = node.end_lineno or node.lineno
- end_col_offset = node.end_col_offset or node.col_offset
-
- for n in ast.walk(node):
- if not hasattr(n, "lineno"):
- continue
-
- if n.lineno < lineno:
- lineno = n.lineno
- col_offset = n.col_offset
- elif n.lineno == lineno and n.col_offset < col_offset:
- col_offset = n.col_offset
-
- if not hasattr(n, "end_lineno") or not n.end_lineno:
- continue
-
- if n.end_lineno > end_lineno:
- end_lineno = n.end_lineno
- if n.end_col_offset:
- end_col_offset = n.end_col_offset
- elif n.end_lineno == end_lineno and n.end_col_offset and n.end_col_offset > end_col_offset:
- end_col_offset = n.end_col_offset
-
- return (lineno, col_offset, end_lineno, end_col_offset)
+ @def get_location(node: ast.AST) -> tuple[int, int, int, int]:
"""Get location lines and columns that encompasses node and all child nodes."""
lineno = node.lineno
col_offset = node.col_offset
end_lineno = node.end_lineno or node.lineno
end_col_offset = node.end_col_offset or node.col_offset
for n in ast.walk(node):
if not hasattr(n, 'lineno'):
continue
if n.lineno < lineno:
lineno = n.lineno
col_offset = n.col_offset
elif n.lineno == lineno and n.col_offset < col_offset:
col_offset = n.col_offset
if not hasattr(n, 'end_lineno') or not n.end_lineno:
continue
if n.end_lineno > end_lineno:
end_lineno = n.end_lineno
if n.end_col_offset:
end_col_offset = n.end_col_offset
elif n.end_lineno == end_lineno and n.end_col_offset and (n.end_col_offset > end_col_offset):
end_col_offset = n.end_col_offset
return (lineno, col_offset, end_lineno, end_col_offset)
@staticmethod
def add_parent_attr(parsed_ast: ast.Module) -> None:
|
||
| 61 |
def get_location(node: ast.AST) -> tuple[int, int, int, int]: |
|
| 62 |
"""Get location lines and columns that encompasses node and all child nodes.""" |
|
| 63 |
lineno = node.lineno |
|
| 64 |
col_offset = node.col_offset |
|
| ▸ | 65 |
end_lineno = node.end_lineno or node.lineno |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:65
@@ -62,7 +62,7 @@
"""Get location lines and columns that encompasses node and all child nodes."""
lineno = node.lineno
col_offset = node.col_offset
- end_lineno = node.end_lineno or node.lineno
+ end_lineno = node.end_lineno and node.lineno
end_col_offset = node.end_col_offset or node.col_offset
for n in ast.walk(node):
|
||
| ▸ | 66 |
end_col_offset = node.end_col_offset or node.col_offset |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:66
@@ -63,7 +63,7 @@
lineno = node.lineno
col_offset = node.col_offset
end_lineno = node.end_lineno or node.lineno
- end_col_offset = node.end_col_offset or node.col_offset
+ end_col_offset = node.end_col_offset and node.col_offset
for n in ast.walk(node):
if not hasattr(n, "lineno"):
|
||
| 67 | ||
| ▸ | 68 |
for n in ast.walk(node): |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:68
@@ -65,7 +65,7 @@
end_lineno = node.end_lineno or node.lineno
end_col_offset = node.end_col_offset or node.col_offset
- for n in ast.walk(node):
+ for n in None:
if not hasattr(n, "lineno"):
continue
|
||
| ▸ | 69 |
if not hasattr(n, "lineno"): |
|
Status: Mutant Found Mutator Name: UnaryOp Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:69
@@ -66,7 +66,7 @@
end_col_offset = node.end_col_offset or node.col_offset
for n in ast.walk(node):
- if not hasattr(n, "lineno"):
+ if hasattr(n, 'lineno'):
continue
if n.lineno < lineno:
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:69
@@ -66,7 +66,7 @@
end_col_offset = node.end_col_offset or node.col_offset
for n in ast.walk(node):
- if not hasattr(n, "lineno"):
+ if not hasattr(n, 'XXlinenoXX'):
continue
if n.lineno < lineno:
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:69
@@ -66,7 +66,7 @@
end_col_offset = node.end_col_offset or node.col_offset
for n in ast.walk(node):
- if not hasattr(n, "lineno"):
+ if not None:
continue
if n.lineno < lineno:
|
||
| ▸ | 70 |
continue |
|
Status: Mutant Found Mutator Name: Keyword Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:70
@@ -67,7 +67,7 @@
for n in ast.walk(node):
if not hasattr(n, "lineno"):
- continue
+ break
if n.lineno < lineno:
lineno = n.lineno
|
||
| 71 | ||
| ▸ | 72 |
if n.lineno < lineno: |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:72
@@ -69,7 +69,7 @@
if not hasattr(n, "lineno"):
continue
- if n.lineno < lineno:
+ if n.lineno >= lineno:
lineno = n.lineno
col_offset = n.col_offset
elif n.lineno == lineno and n.col_offset < col_offset:
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:72
@@ -69,7 +69,7 @@
if not hasattr(n, "lineno"):
continue
- if n.lineno < lineno:
+ if n.lineno <= lineno:
lineno = n.lineno
col_offset = n.col_offset
elif n.lineno == lineno and n.col_offset < col_offset:
|
||
| 73 |
lineno = n.lineno |
|
| 74 |
col_offset = n.col_offset |
|
| ▸ | 75 |
elif n.lineno == lineno and n.col_offset < col_offset: |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:75
@@ -72,7 +72,7 @@
if n.lineno < lineno:
lineno = n.lineno
col_offset = n.col_offset
- elif n.lineno == lineno and n.col_offset < col_offset:
+ elif n.lineno == lineno or n.col_offset < col_offset:
col_offset = n.col_offset
if not hasattr(n, "end_lineno") or not n.end_lineno:
|
||
| 76 |
col_offset = n.col_offset |
|
| 77 | ||
| ▸ | 78 |
if not hasattr(n, "end_lineno") or not n.end_lineno: |
|
Status: Mutant Found Mutator Name: UnaryOp Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:78
@@ -75,7 +75,7 @@
elif n.lineno == lineno and n.col_offset < col_offset:
col_offset = n.col_offset
- if not hasattr(n, "end_lineno") or not n.end_lineno:
+ if hasattr(n, 'end_lineno') or not n.end_lineno:
continue
if n.end_lineno > end_lineno:
Status: Mutant Found Mutator Name: UnaryOp Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:78
@@ -75,7 +75,7 @@
elif n.lineno == lineno and n.col_offset < col_offset:
col_offset = n.col_offset
- if not hasattr(n, "end_lineno") or not n.end_lineno:
+ if not hasattr(n, "end_lineno") or n.end_lineno:
continue
if n.end_lineno > end_lineno:
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:78
@@ -75,7 +75,7 @@
elif n.lineno == lineno and n.col_offset < col_offset:
col_offset = n.col_offset
- if not hasattr(n, "end_lineno") or not n.end_lineno:
+ if not hasattr(n, 'end_lineno') and (not n.end_lineno):
continue
if n.end_lineno > end_lineno:
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:78
@@ -75,7 +75,7 @@
elif n.lineno == lineno and n.col_offset < col_offset:
col_offset = n.col_offset
- if not hasattr(n, "end_lineno") or not n.end_lineno:
+ if not hasattr(n, 'XXend_linenoXX') or not n.end_lineno:
continue
if n.end_lineno > end_lineno:
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:78
@@ -75,7 +75,7 @@
elif n.lineno == lineno and n.col_offset < col_offset:
col_offset = n.col_offset
- if not hasattr(n, "end_lineno") or not n.end_lineno:
+ if not None or not n.end_lineno:
continue
if n.end_lineno > end_lineno:
|
||
| ▸ | 79 |
continue |
|
Status: Mutant Found Mutator Name: Keyword Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:79
@@ -76,7 +76,7 @@
col_offset = n.col_offset
if not hasattr(n, "end_lineno") or not n.end_lineno:
- continue
+ break
if n.end_lineno > end_lineno:
end_lineno = n.end_lineno
|
||
| 80 | ||
| ▸ | 81 |
if n.end_lineno > end_lineno: |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:81
@@ -78,7 +78,7 @@
if not hasattr(n, "end_lineno") or not n.end_lineno:
continue
- if n.end_lineno > end_lineno:
+ if n.end_lineno <= end_lineno:
end_lineno = n.end_lineno
if n.end_col_offset:
end_col_offset = n.end_col_offset
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:81
@@ -78,7 +78,7 @@
if not hasattr(n, "end_lineno") or not n.end_lineno:
continue
- if n.end_lineno > end_lineno:
+ if n.end_lineno >= end_lineno:
end_lineno = n.end_lineno
if n.end_col_offset:
end_col_offset = n.end_col_offset
|
||
| 82 |
end_lineno = n.end_lineno |
|
| 83 |
if n.end_col_offset: |
|
| 84 |
end_col_offset = n.end_col_offset |
|
| ▸ | 85 |
elif n.end_lineno == end_lineno and n.end_col_offset and n.end_col_offset > end_col_offset: |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:85
@@ -82,7 +82,7 @@
end_lineno = n.end_lineno
if n.end_col_offset:
end_col_offset = n.end_col_offset
- elif n.end_lineno == end_lineno and n.end_col_offset and n.end_col_offset > end_col_offset:
+ elif n.end_lineno == end_lineno or n.end_col_offset or n.end_col_offset > end_col_offset:
end_col_offset = n.end_col_offset
return (lineno, col_offset, end_lineno, end_col_offset)
|
||
| 86 |
end_col_offset = n.end_col_offset |
|
| 87 | ||
| ▸ | 88 |
return (lineno, col_offset, end_lineno, end_col_offset) |
|
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:88
@@ -85,7 +85,7 @@
elif n.end_lineno == end_lineno and n.end_col_offset and n.end_col_offset > end_col_offset:
end_col_offset = n.end_col_offset
- return (lineno, col_offset, end_lineno, end_col_offset)
+ return None
@staticmethod
def add_parent_attr(parsed_ast: ast.Module) -> None:
|
||
| 89 | ||
| ▸ | 90 |
@staticmethod |
|
Status: Mutant Found Mutator Name: Decorator Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:90
@@ -87,12 +87,7 @@
return (lineno, col_offset, end_lineno, end_col_offset)
- @staticmethod
- def add_parent_attr(parsed_ast: ast.Module) -> None:
- """Update all child nodes in tree with parent field."""
- for node in ast.walk(parsed_ast):
- for child in ast.iter_child_nodes(node):
- child.parent = node # type: ignore [attr-defined]
+ @def add_parent_attr(parsed_ast: ast.Module) -> None:
"""Update all child nodes in tree with parent field."""
for node in ast.walk(parsed_ast):
for child in ast.iter_child_nodes(node):
child.parent = node # type: ignore [attr-defined]
@classmethod
def is_annotation(cls, node: ast.AST, child_node: ast.AST | None = None) -> bool: # nomut: Keyword
|
||
| 91 |
def add_parent_attr(parsed_ast: ast.Module) -> None: |
|
| 92 |
"""Update all child nodes in tree with parent field.""" |
|
| ▸ | 93 |
for node in ast.walk(parsed_ast): |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:93
@@ -90,7 +90,7 @@
@staticmethod
def add_parent_attr(parsed_ast: ast.Module) -> None:
"""Update all child nodes in tree with parent field."""
- for node in ast.walk(parsed_ast):
+ for node in None:
for child in ast.iter_child_nodes(node):
child.parent = node # type: ignore [attr-defined]
|
||
| ▸ | 94 |
for child in ast.iter_child_nodes(node): |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:94
@@ -91,7 +91,7 @@
def add_parent_attr(parsed_ast: ast.Module) -> None:
"""Update all child nodes in tree with parent field."""
for node in ast.walk(parsed_ast):
- for child in ast.iter_child_nodes(node):
+ for child in None:
child.parent = node # type: ignore [attr-defined]
@classmethod
|
||
| 95 |
child.parent = node # type: ignore [attr-defined] |
|
| 96 | ||
| ▸ | 97 |
@classmethod |
|
Status: Mutant Found Mutator Name: Decorator Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:97
@@ -94,22 +94,7 @@
for child in ast.iter_child_nodes(node):
child.parent = node # type: ignore [attr-defined]
- @classmethod
- def is_annotation(cls, node: ast.AST, child_node: ast.AST | None = None) -> bool: # nomut: Keyword
- """Recursively search parent nodes to see if the starting node is part of an annotation.
-
- Returns true if a parent node points to this node in an annotation or returns attribute.
- """
- if not hasattr(node, "parent") or not node.parent:
- return False
-
- if hasattr(node, "annotation") and node.annotation == child_node:
- return True
-
- if hasattr(node, "returns") and node.returns == child_node:
- return True
-
- return cls.is_annotation(node.parent, child_node=node)
+ @def is_annotation(cls, node: ast.AST, child_node: ast.AST | None=None) -> bool:
"""Recursively search parent nodes to see if the starting node is part of an annotation.
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
if not hasattr(node, 'parent') or not node.parent:
return False
if hasattr(node, 'annotation') and node.annotation == child_node:
return True
if hasattr(node, 'returns') and node.returns == child_node:
return True
return cls.is_annotation(node.parent, child_node=node)
# runner method signature:
|
||
| 98 |
def is_annotation(cls, node: ast.AST, child_node: ast.AST | None = None) -> bool: # nomut: Keyword |
|
| 99 |
"""Recursively search parent nodes to see if the starting node is part of an annotation. |
|
| 100 | ||
| 101 |
Returns true if a parent node points to this node in an annotation or returns attribute. |
|
| 102 |
""" |
|
| ▸ | 103 |
if not hasattr(node, "parent") or not node.parent: |
|
Status: Mutant Found Mutator Name: UnaryOp Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:103
@@ -100,7 +100,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
- if not hasattr(node, "parent") or not node.parent:
+ if hasattr(node, 'parent') or not node.parent:
return False
if hasattr(node, "annotation") and node.annotation == child_node:
Status: Mutant Found Mutator Name: UnaryOp Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:103
@@ -100,7 +100,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
- if not hasattr(node, "parent") or not node.parent:
+ if not hasattr(node, "parent") or node.parent:
return False
if hasattr(node, "annotation") and node.annotation == child_node:
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:103
@@ -100,7 +100,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
- if not hasattr(node, "parent") or not node.parent:
+ if not hasattr(node, 'parent') and (not node.parent):
return False
if hasattr(node, "annotation") and node.annotation == child_node:
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:103
@@ -100,7 +100,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
- if not hasattr(node, "parent") or not node.parent:
+ if not hasattr(node, 'XXparentXX') or not node.parent:
return False
if hasattr(node, "annotation") and node.annotation == child_node:
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:103
@@ -100,7 +100,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
- if not hasattr(node, "parent") or not node.parent:
+ if not None or not node.parent:
return False
if hasattr(node, "annotation") and node.annotation == child_node:
|
||
| ▸ | 104 |
return False |
|
Status: Mutant Found Mutator Name: Keyword Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:104
@@ -101,7 +101,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
if not hasattr(node, "parent") or not node.parent:
- return False
+ return True
if hasattr(node, "annotation") and node.annotation == child_node:
return True
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:104
@@ -101,7 +101,7 @@
Returns true if a parent node points to this node in an annotation or returns attribute.
"""
if not hasattr(node, "parent") or not node.parent:
- return False
+ return None
if hasattr(node, "annotation") and node.annotation == child_node:
return True
|
||
| 105 | ||
| ▸ | 106 |
if hasattr(node, "annotation") and node.annotation == child_node: |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:106
@@ -103,7 +103,7 @@
if not hasattr(node, "parent") or not node.parent:
return False
- if hasattr(node, "annotation") and node.annotation == child_node:
+ if hasattr(node, 'annotation') or node.annotation == child_node:
return True
if hasattr(node, "returns") and node.returns == child_node:
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:106
@@ -103,7 +103,7 @@
if not hasattr(node, "parent") or not node.parent:
return False
- if hasattr(node, "annotation") and node.annotation == child_node:
+ if hasattr(node, 'XXannotationXX') and node.annotation == child_node:
return True
if hasattr(node, "returns") and node.returns == child_node:
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:106
@@ -103,7 +103,7 @@
if not hasattr(node, "parent") or not node.parent:
return False
- if hasattr(node, "annotation") and node.annotation == child_node:
+ if None and node.annotation == child_node:
return True
if hasattr(node, "returns") and node.returns == child_node:
|
||
| ▸ | 107 |
return True |
|
Status: Mutant Found Mutator Name: Keyword Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:107
@@ -104,7 +104,7 @@
return False
if hasattr(node, "annotation") and node.annotation == child_node:
- return True
+ return False
if hasattr(node, "returns") and node.returns == child_node:
return True
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:107
@@ -104,7 +104,7 @@
return False
if hasattr(node, "annotation") and node.annotation == child_node:
- return True
+ return None
if hasattr(node, "returns") and node.returns == child_node:
return True
|
||
| 108 | ||
| ▸ | 109 |
if hasattr(node, "returns") and node.returns == child_node: |
|
Status: Mutant Found Mutator Name: Compare Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:109
@@ -106,7 +106,7 @@
if hasattr(node, "annotation") and node.annotation == child_node:
return True
- if hasattr(node, "returns") and node.returns == child_node:
+ if hasattr(node, 'returns') or node.returns == child_node:
return True
return cls.is_annotation(node.parent, child_node=node)
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:109
@@ -106,7 +106,7 @@
if hasattr(node, "annotation") and node.annotation == child_node:
return True
- if hasattr(node, "returns") and node.returns == child_node:
+ if hasattr(node, 'XXreturnsXX') and node.returns == child_node:
return True
return cls.is_annotation(node.parent, child_node=node)
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:109
@@ -106,7 +106,7 @@
if hasattr(node, "annotation") and node.annotation == child_node:
return True
- if hasattr(node, "returns") and node.returns == child_node:
+ if None and node.returns == child_node:
return True
return cls.is_annotation(node.parent, child_node=node)
|
||
| ▸ | 110 |
return True |
|
Status: Mutant Found Mutator Name: Keyword Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:110
@@ -107,7 +107,7 @@
return True
if hasattr(node, "returns") and node.returns == child_node:
- return True
+ return False
return cls.is_annotation(node.parent, child_node=node)
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:110
@@ -107,7 +107,7 @@
return True
if hasattr(node, "returns") and node.returns == child_node:
- return True
+ return None
return cls.is_annotation(node.parent, child_node=node)
|
||
| 111 | ||
| ▸ | 112 |
return cls.is_annotation(node.parent, child_node=node) |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:112
@@ -109,7 +109,7 @@
if hasattr(node, "returns") and node.returns == child_node:
return True
- return cls.is_annotation(node.parent, child_node=node)
+ return None
# runner method signature:
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\data_types\interfaces.py
+++ [Mutant] src\poodle\data_types\interfaces.py:112
@@ -109,7 +109,7 @@
if hasattr(node, "returns") and node.returns == child_node:
return True
- return cls.is_annotation(node.parent, child_node=node)
+ return None
# runner method signature:
|
||
| 113 | ||
| 114 | ||
| 115 |
# runner method signature: |
|
| 116 |
def runner( # type: ignore [empty-body] |
|
| 117 |
config: PoodleConfig, |
|
| 118 |
echo: Callable, |
|
| 119 |
run_folder: Path, |
|
| 120 |
mutant: Mutant, |
|
| 121 |
timeout: float | None, |
|
| 122 |
*_, |
|
| 123 |
**__, |
|
| 124 |
) -> MutantTrialResult: |
|
| 125 |
"""Run trial of mutant in specified folder. |
|
| 126 | ||
| 127 |
Files from the source folder have been copied to the run folder, and mutation has been applied. |
|
| 128 |
""" |
|
| 129 | ||
| 130 | ||
| 131 |
# reporter method signature: |
|
| 132 |
def reporter( # type: ignore [empty-body] |
|
| 133 |
config: PoodleConfig, |
|
| 134 |
echo: Callable, |
|
| 135 |
testing_results: TestingResults, |
|
| 136 |
*_, |
|
| 137 |
**__, |
|
| 138 |
) -> None: |
|
| 139 |
"""Report on Testing Results.""" |