Skip to content

Commit e1bdd9c

Browse files
Refactor mapping key helper boundaries to canonical usage
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 1b07fdf commit e1bdd9c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

tests/test_mapping_copy_helper_import_boundary.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import pytest
55

6+
from tests.test_mapping_helpers_usage import ALLOWED_COPY_VALUES_CALL_FILES
67
from tests.test_mapping_utils_import_boundary import EXPECTED_MAPPING_EXTRA_IMPORTERS
7-
from tests.test_tool_mapping_reader_usage import TOOLS_MODULE
88

99
pytestmark = pytest.mark.architecture
1010

@@ -34,7 +34,12 @@ def test_copy_mapping_values_by_string_keys_imports_are_centralized():
3434
if _imports_copy_mapping_values_by_string_keys(module_text):
3535
discovered_modules.append(module_path.as_posix())
3636

37+
expected_runtime_modules = sorted(
38+
f"hyperbrowser/{path.as_posix()}"
39+
for path in ALLOWED_COPY_VALUES_CALL_FILES
40+
if path != Path("mapping_utils.py")
41+
)
3742
expected_modules = sorted(
38-
[TOOLS_MODULE.as_posix(), *EXPECTED_MAPPING_EXTRA_IMPORTERS]
43+
[*expected_runtime_modules, *EXPECTED_MAPPING_EXTRA_IMPORTERS]
3944
)
4045
assert discovered_modules == expected_modules

tests/test_mapping_read_keys_helper_import_boundary.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import pytest
55

6+
from tests.test_mapping_helpers_usage import ALLOWED_READ_KEYS_CALL_FILES
67
from tests.test_mapping_utils_import_boundary import EXPECTED_MAPPING_EXTRA_IMPORTERS
7-
from tests.test_tool_mapping_reader_usage import TOOLS_MODULE
88

99
pytestmark = pytest.mark.architecture
1010

@@ -34,7 +34,12 @@ def test_read_string_mapping_keys_imports_are_centralized():
3434
if _imports_read_string_mapping_keys(module_text):
3535
discovered_modules.append(module_path.as_posix())
3636

37+
expected_runtime_modules = sorted(
38+
f"hyperbrowser/{path.as_posix()}"
39+
for path in ALLOWED_READ_KEYS_CALL_FILES
40+
if path != Path("mapping_utils.py")
41+
)
3742
expected_modules = sorted(
38-
[TOOLS_MODULE.as_posix(), *EXPECTED_MAPPING_EXTRA_IMPORTERS]
43+
[*expected_runtime_modules, *EXPECTED_MAPPING_EXTRA_IMPORTERS]
3944
)
4045
assert discovered_modules == expected_modules

0 commit comments

Comments
 (0)