Use new observer in statement slicing test.
@@ -24,6 +24,7 @@ from pynguin.ga.computations import (
TestSuiteStatementCheckedCoverageFunction,
)
from pynguin.instrumentation.machinery import install_import_hook
+from pynguin.slicer.checkedlinesobserver import CheckedLineObserver
from pynguin.slicer.dynamicslicer import DynamicSlicer
from pynguin.testcase.execution import ExecutionTracer, TestCaseExecutor
from pynguin.testcase.statement import MethodStatement
@@ -65,6 +66,7 @@ def test_testsuite_statement_checked_coverage_calculation(plus_three_test):
importlib.reload(module)
executor = TestCaseExecutor(tracer)
+ executor.add_observer(CheckedLineObserver(executor.tracer.get_known_data()))
ff = TestSuiteStatementCheckedCoverageFunction(executor)
assert ff.compute_coverage(test_suite) == pytest.approx(4 / 8, 0.1, 0.1)
@@ -121,6 +123,7 @@ def test_testcase_statement_checked_coverage_calculation(plus_three_test):
importlib.reload(module)
executor = TestCaseExecutor(tracer)
+ executor.add_observer(CheckedLineObserver(executor.tracer.get_known_data()))
ff = TestCaseStatementCheckedCoverageFunction(executor)
assert ff.compute_coverage(test_case_chromosome) == pytest.approx(
@@ -145,6 +148,7 @@ def test_only_void_function(setter_test):
importlib.reload(module)
executor = TestCaseExecutor(tracer)
+ executor.add_observer(CheckedLineObserver(executor.tracer.get_known_data()))
ff = TestCaseStatementCheckedCoverageFunction(executor)
assert ff.compute_coverage(test_case_chromosome) == pytest.approx(
@@ -207,6 +211,7 @@ def test_getter_before_setter(getter_setter_test):
importlib.reload(module)
executor = TestCaseExecutor(tracer)
+ executor.add_observer(CheckedLineObserver(executor.tracer.get_known_data()))
ff = TestCaseStatementCheckedCoverageFunction(executor)
assert ff.compute_coverage(test_case_chromosome) == pytest.approx(
@@ -284,6 +289,7 @@ def test_getter_after_setter(setter_getter_test):
importlib.reload(module)
executor = TestCaseExecutor(tracer)
+ executor.add_observer(CheckedLineObserver(executor.tracer.get_known_data()))
ff = TestCaseStatementCheckedCoverageFunction(executor)
assert ff.compute_coverage(test_case_chromosome) == pytest.approx(
