Update tests/test_utils_snapshot.py
Run CI Tests / test (push) Successful in 31s

This commit is contained in:
2025-07-30 00:06:33 +02:00
parent e028805b22
commit 5efc349f2b
+4 -5
View File
@@ -3,7 +3,6 @@ import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from slic.utils.snapshot import *
from slic.utils.registry import instances
from unittest.mock import patch
@@ -34,7 +33,7 @@ def test_snapshot_excludes_internal_by_default():
visible = FakeAdjustable("visible", internal=False)
hidden = FakeAdjustable("internal", internal=True)
with patch("slic.utils.typecast.instances", return_value=[visible, hidden]):
with patch("slic.utils.registry.instances", return_value=[visible, hidden]):
result = snapshot()
assert visible in result
assert hidden not in result
@@ -45,7 +44,7 @@ def test_snapshot_include_internal_flag():
visible = FakeAdjustable("visible", internal=False)
hidden = FakeAdjustable("internal", internal=True)
with patch("slic.utils.typecast.instances", return_value=[visible, hidden]):
with patch("slic.utils.registry.instances", return_value=[visible, hidden]):
result = snapshot(include_internal=True)
assert visible in result
assert hidden in result
@@ -54,7 +53,7 @@ def test_snapshot_include_internal_flag():
def test_snapshot_empty_result():
with patch("slic.utils.typecast.instances", return_value=[]):
with patch("slic.utils.registry.instances", return_value=[]):
result = snapshot()
assert isinstance(result, list)
assert result == []
@@ -84,7 +83,7 @@ def test_snapshot_sort_keys(sort_key, expected_order):
name_to_obj = {adj.name: adj for adj in [a, b, c]}
unordered = [c, a, b] # intentionally unsorted
with patch("slic.utils.typecast.instances", return_value=unordered):
with patch("slic.utils.registry.instances", return_value=unordered):
result = snapshot(sort_key=sort_key)
# We check that the objects returned match the expected names (using original mapping)
result_names = [adj.name for adj in result]