| 1 |
"""Mutate Unary Operations.""" |
|
| 2 | ||
| 3 |
from __future__ import annotations |
|
| 4 | ||
| 5 |
import ast |
|
| 6 | ||
| 7 |
from poodle.data_types import FileMutation, Mutator |
|
| 8 | ||
| 9 | ||
| 10 |
class UnaryOperationMutator(ast.NodeVisitor, Mutator): |
|
| 11 |
"""Mutate Unary Operations.""" |
|
| 12 | ||
| 13 |
# https://docs.python.org/3/library/ast.html#ast.UnaryOp |
|
| 14 |
# https://www.w3schools.com/python/python_operators.asp |
|
| 15 |
# ast.UAdd + |
|
| 16 |
# ast.USub - |
|
| 17 |
# ast.Not not |
|
| 18 |
# ast.Invert ~ |
|
| 19 | ||
| ▸ | 20 |
mutator_name = "UnaryOp" |
|
Status: Mutant Found Mutator Name: String Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:20
@@ -17,7 +17,7 @@
# ast.Not not
# ast.Invert ~
- mutator_name = "UnaryOp"
+ mutator_name = 'XXUnaryOpXX'
mutants: list[FileMutation]
def create_mutations(self, parsed_ast: ast.Module, *_, **__) -> list[FileMutation]:
|
||
| 21 |
mutants: list[FileMutation] |
|
| 22 | ||
| 23 |
def create_mutations(self, parsed_ast: ast.Module, *_, **__) -> list[FileMutation]: |
|
| 24 |
"""Visit all Unary Operations and return created mutants.""" |
|
| 25 |
self.mutants = [] |
|
| ▸ | 26 |
self.visit(parsed_ast) |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:26
@@ -23,7 +23,7 @@
def create_mutations(self, parsed_ast: ast.Module, *_, **__) -> list[FileMutation]:
"""Visit all Unary Operations and return created mutants."""
self.mutants = []
- self.visit(parsed_ast)
+ None
return self.mutants
def visit_UnaryOp(self, node: ast.UnaryOp) -> None:
|
||
| ▸ | 27 |
return self.mutants |
|
Status: Mutant Found Mutator Name: Return Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:27
@@ -24,7 +24,7 @@
"""Visit all Unary Operations and return created mutants."""
self.mutants = []
self.visit(parsed_ast)
- return self.mutants
+ return None
def visit_UnaryOp(self, node: ast.UnaryOp) -> None:
"""Create mutations."""
|
||
| 28 | ||
| 29 |
def visit_UnaryOp(self, node: ast.UnaryOp) -> None: |
|
| 30 |
"""Create mutations.""" |
|
| ▸ | 31 |
if isinstance(node.op, ast.UAdd): |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:31
@@ -28,7 +28,7 @@
def visit_UnaryOp(self, node: ast.UnaryOp) -> None:
"""Create mutations."""
- if isinstance(node.op, ast.UAdd):
+ if None:
self.mutants.append(
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.USub(), operand=node.operand))),
)
|
||
| ▸ | 32 |
self.mutants.append( |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:32
@@ -29,9 +29,7 @@
def visit_UnaryOp(self, node: ast.UnaryOp) -> None:
"""Create mutations."""
if isinstance(node.op, ast.UAdd):
- self.mutants.append(
- self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.USub(), operand=node.operand))),
- )
+ None
if isinstance(node.op, ast.USub):
self.mutants.append(
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.UAdd(), operand=node.operand))),
|
||
| 33 |
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.USub(), operand=node.operand))), |
|
| 34 |
) |
|
| ▸ | 35 |
if isinstance(node.op, ast.USub): |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:35
@@ -32,7 +32,7 @@
self.mutants.append(
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.USub(), operand=node.operand))),
)
- if isinstance(node.op, ast.USub):
+ if None:
self.mutants.append(
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.UAdd(), operand=node.operand))),
)
|
||
| ▸ | 36 |
self.mutants.append( |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:36
@@ -33,8 +33,6 @@
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.USub(), operand=node.operand))),
)
if isinstance(node.op, ast.USub):
- self.mutants.append(
- self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.UAdd(), operand=node.operand))),
- )
+ None
if isinstance(node.op, (ast.Not, ast.Invert)):
self.mutants.append(self.create_file_mutation(node, ast.unparse(node.operand)))
|
||
| 37 |
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.UAdd(), operand=node.operand))), |
|
| 38 |
) |
|
| ▸ | 39 |
if isinstance(node.op, (ast.Not, ast.Invert)): |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:39
@@ -36,5 +36,5 @@
self.mutants.append(
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.UAdd(), operand=node.operand))),
)
- if isinstance(node.op, (ast.Not, ast.Invert)):
+ if None:
self.mutants.append(self.create_file_mutation(node, ast.unparse(node.operand)))
|
||
| ▸ | 40 |
self.mutants.append(self.create_file_mutation(node, ast.unparse(node.operand))) |
|
Status: Mutant Found Mutator Name: FuncCall Unified Diff: --- src\poodle\mutators\unary_op.py
+++ [Mutant] src\poodle\mutators\unary_op.py:40
@@ -37,4 +37,4 @@
self.create_file_mutation(node, ast.unparse(ast.UnaryOp(op=ast.UAdd(), operand=node.operand))),
)
if isinstance(node.op, (ast.Not, ast.Invert)):
- self.mutants.append(self.create_file_mutation(node, ast.unparse(node.operand)))
+ None
|