Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.d/20260207_234758_qdewaghe_get_snapshot_value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- `get_snapshot_value` now works even if no assertions were made on the snapshot.
2 changes: 1 addition & 1 deletion src/inline_snapshot/_get_snapshot_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def unwrap(value):
if isinstance(value, GenericValue):
return adapter_map(value._visible_value(), lambda v: unwrap(v)[0]), True
return adapter_map(value._old_value, lambda v: unwrap(v)[0]), True

if isinstance(value, (External, Outsourced, ExternalFile)):
try:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_get_snapshot_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ def test_dataclass(try_snapshot_disable):
assert s == A(a=outsource(5), b=2)

assert inspect(get_snapshot_value(s)) == snapshot("A(a=5, b=2)")


def test_no_assert():
assert get_snapshot_value(snapshot([])) == []
Loading