This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from slic.utils import snapshot
|
||||
from slic.utils import snapshot as snapshot_module
|
||||
from slic.core.adjustable import Adjustable
|
||||
from unittest.mock import patch
|
||||
|
||||
@@ -32,7 +32,7 @@ def test_snapshot_excludes_internal_by_default():
|
||||
hidden = FakeAdjustable("internal", internal=True)
|
||||
|
||||
with patch("slic.utils.snapshot.instances", return_value=[visible, hidden]):
|
||||
result = snapshot.snapshot()
|
||||
result = snapshot_module.snapshot()
|
||||
assert visible in result
|
||||
assert hidden not in result
|
||||
|
||||
@@ -43,7 +43,7 @@ def test_snapshot_include_internal_flag():
|
||||
hidden = FakeAdjustable("internal", internal=True)
|
||||
|
||||
with patch("slic.utils.snapshot.instances", return_value=[visible, hidden]):
|
||||
result = snapshot.snapshot(include_internal=True)
|
||||
result = snapshot_module.snapshot(include_internal=True)
|
||||
assert visible in result
|
||||
assert hidden in result
|
||||
assert len(result) == 2
|
||||
@@ -52,7 +52,7 @@ def test_snapshot_include_internal_flag():
|
||||
def test_snapshot_empty_result():
|
||||
|
||||
with patch("slic.utils.snapshot.instances", return_value=[]):
|
||||
result = snapshot.snapshot()
|
||||
result = snapshot_module.snapshot()
|
||||
assert isinstance(result, list)
|
||||
assert result == []
|
||||
|
||||
@@ -82,7 +82,7 @@ def test_snapshot_sort_keys(sort_key, expected_order):
|
||||
unordered = [c, a, b] # intentionally unsorted
|
||||
|
||||
with patch("slic.utils.snapshot.instances", return_value=unordered):
|
||||
result = snapshot.snapshot(sort_key=sort_key)
|
||||
result = snapshot_module.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]
|
||||
assert result_names == [name_to_obj[n].name for n in expected_order]
|
||||
|
||||
Reference in New Issue
Block a user