diff --git a/tests/test_inspection_legacy_ports.py b/tests/test_inspection_legacy_ports.py index 13e6c54..902ce04 100644 --- a/tests/test_inspection_legacy_ports.py +++ b/tests/test_inspection_legacy_ports.py @@ -10,6 +10,7 @@ import io import json import tempfile import unittest +import unittest.mock import zlib from pathlib import Path @@ -210,12 +211,11 @@ class TestOverwrittenPromptManagerText(unittest.TestCase): def test_the_workflow_is_parsed_only_for_prompt_manager_graphs(self): # Review M-4: no PromptManager-like node, no workflow parse. - from unittest import mock from utils import prompt_inspector prompt = parity.build("f02")["prompt"] - with mock.patch.object( + with unittest.mock.patch.object( prompt_inspector, "_parsed_workflow", wraps=prompt_inspector._parsed_workflow, diff --git a/tests/test_inspection_outcomes.py b/tests/test_inspection_outcomes.py index c7670b6..a3c3555 100644 --- a/tests/test_inspection_outcomes.py +++ b/tests/test_inspection_outcomes.py @@ -3,9 +3,9 @@ import ast import json import unittest +import unittest.mock from pathlib import Path from dataclasses import replace -from unittest import mock from utils import prompt_pair_resolver from utils.inspection_outcomes import ( @@ -235,7 +235,7 @@ class TestOutcomeMessages(unittest.TestCase): "reason_code": None, "node": None, } - with mock.patch( + with unittest.mock.patch( "utils.prompt_inspector.resolve_prompt_pair", return_value=resolved ): evidence = inspect_prompt_evidence({"prompt": {}}) diff --git a/tests/test_inspection_semantics.py b/tests/test_inspection_semantics.py index 73ba753..8739e04 100644 --- a/tests/test_inspection_semantics.py +++ b/tests/test_inspection_semantics.py @@ -9,9 +9,9 @@ import copy import json import tempfile import unittest +import unittest.mock from pathlib import Path from types import MappingProxyType -from unittest import mock from utils import inspection_semantics as semantics from utils.inspection_semantics import SemanticsError, load_semantics @@ -700,7 +700,9 @@ class ValidationTest(_TableCase): self.assertIn("nest", str(caught.exception)) self.assertGreater(semantics.MAX_NESTING, _depth(json.loads(TABLE.read_text()))) # Whichever interpreter limit the parser hits, it is a SemanticsError. - with mock.patch.object(semantics.json, "loads", side_effect=RecursionError): + with unittest.mock.patch.object( + semantics.json, "loads", side_effect=RecursionError + ): with self.assertRaises(SemanticsError) as caught: self.load_doc(_minimal()) self.assertIn("nests deeper", str(caught.exception))