This commit is contained in:
@@ -31,7 +31,7 @@ def test_snapshot_excludes_internal_by_default():
|
|||||||
visible = FakeAdjustable("visible", internal=False)
|
visible = FakeAdjustable("visible", internal=False)
|
||||||
hidden = FakeAdjustable("internal", internal=True)
|
hidden = FakeAdjustable("internal", internal=True)
|
||||||
|
|
||||||
with patch("slic.utils.snapshot.instances", return_value=[visible, hidden]):
|
with patch.object(snapshot_module, "instances", return_value=[visible, hidden]):
|
||||||
result = snapshot_module.snapshot()
|
result = snapshot_module.snapshot()
|
||||||
assert visible in result
|
assert visible in result
|
||||||
assert hidden not in result
|
assert hidden not in result
|
||||||
@@ -42,7 +42,7 @@ def test_snapshot_include_internal_flag():
|
|||||||
visible = FakeAdjustable("visible", internal=False)
|
visible = FakeAdjustable("visible", internal=False)
|
||||||
hidden = FakeAdjustable("internal", internal=True)
|
hidden = FakeAdjustable("internal", internal=True)
|
||||||
|
|
||||||
with patch("slic.utils.snapshot.instances", return_value=[visible, hidden]):
|
with patch.object(snapshot_module, "instances", return_value=[visible, hidden]):
|
||||||
result = snapshot_module.snapshot(include_internal=True)
|
result = snapshot_module.snapshot(include_internal=True)
|
||||||
assert visible in result
|
assert visible in result
|
||||||
assert hidden in result
|
assert hidden in result
|
||||||
@@ -50,7 +50,7 @@ def test_snapshot_include_internal_flag():
|
|||||||
|
|
||||||
|
|
||||||
def test_snapshot_empty_result():
|
def test_snapshot_empty_result():
|
||||||
with patch("slic.utils.snapshot.instances", return_value=[]):
|
with patch.object(snapshot_module, "instances", return_value=[]):
|
||||||
result = snapshot_module.snapshot()
|
result = snapshot_module.snapshot()
|
||||||
assert isinstance(result, list)
|
assert isinstance(result, list)
|
||||||
assert result == []
|
assert result == []
|
||||||
@@ -80,7 +80,7 @@ def test_snapshot_sort_keys(sort_key, expected_order):
|
|||||||
name_to_obj = {adj.name: adj for adj in [a, b, c]}
|
name_to_obj = {adj.name: adj for adj in [a, b, c]}
|
||||||
unordered = [c, a, b] # intentionally unsorted
|
unordered = [c, a, b] # intentionally unsorted
|
||||||
|
|
||||||
with patch("slic.utils.snapshot.instances", return_value=unordered):
|
with patch.object(snapshot_module, "instances", return_value=unordered):
|
||||||
result = snapshot_module.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)
|
# We check that the objects returned match the expected names (using original mapping)
|
||||||
result_names = [adj.name for adj in result]
|
result_names = [adj.name for adj in result]
|
||||||
|
|||||||
Reference in New Issue
Block a user