Skip to content

Releases: 15r10nk/inline-snapshot

0.34.1

05 Jun 16:58

Choose a tag to compare

Fixed

  • Fixed snapshot_arg() to use the fix category (instead of create) when creating an argument with an existing non-ellipsis default argument value.

0.34.0

29 May 21:01

Choose a tag to compare

Added

  • get_snapshot_value() now accepts a which parameter ("new" or "old") to select whether to return the new (just-compared) or the old (previously stored) snapshot value (#336).

Fixed

  • Example.run_pytest: deterministic test order by using -p no:ranodmly

0.33.0

12 May 18:39

Choose a tag to compare

Added

  • snapshot_arg(), which lets you move snapshot() calls from the call site into the helper function itself.

  • Example.format(): new method to format a Python file in the example using Black.

  • Example.is_formatted(): new method to check whether a Python file in the example is already Black-formatted.

Changed

  • Example.run_inline: exception strings in raises are now formatted the same way inline_snapshot.extra.raises does, which is shorter for small assertions like raises=snapshot("UsageError: default value cannot be a Custom value").

  • Example.run_inline: the raises, stderr, and changed_files arguments are now handled with snapshot_arg(), so snapshot() is no longer needed at the call site. raises defaults to "<no exception>" and changed_files defaults to {}.

  • Example.run_inline: the reported_categories argument is now handled with snapshot_arg() and its type changed from list[Category] to set[Category]. It is now only asserted when the reported categories differ from the CLI flags passed via args.

  • Example.run_pytest: the returncode, error, stderr, changed_files, and outcomes arguments are now handled with snapshot_arg(), so snapshot() is no longer needed at the call site. returncode defaults to 0, changed_files defaults to {}, and outcomes defaults to {"passed": 1}.

  • Example.run_pytest: the error assertion is now only performed on Python ≥ 3.11.

  • Example.run_pytest: stdout and stderr are now printed as Rich panels instead of plain text.

  • extra.raises: the exception argument is now handled with snapshot_arg(), so snapshot() is no longer needed at the call site.

  • extra.prints: the stdout and stderr arguments are now handled with snapshot_arg(), so snapshot() is no longer needed at the call site.

  • extra.warns: the expected_warnings argument is now handled with snapshot_arg(), so snapshot() is no longer needed at the call site.

  • extra.Transformed and extra.transformation: the value argument is now handled with snapshot_arg().

Fixed

  • Fixed repr(external_file(...)) to use a path relative to the calling file instead of the absolute path, which also fixes incorrect reprs on Windows.

0.32.7

23 Apr 19:00

Choose a tag to compare

Fixed

  • Fixed snapshot comparison for dicts where keys are dataclass instances (or other custom objects used as dict keys), which previously caused corrupted snapshots — either collapsing multiple entries into one or appending duplicate keys on subsequent runs (#363).
  • Fixed tuple snapshot updates to compare elements positionally rather than using sequence alignment, so existing expressions (e.g. 3 + 3) are preserved when elements are removed from or added to a tuple.

0.32.6

10 Apr 05:46

Choose a tag to compare

Fixed

  • Pydantic models, attrs and dataclasses with NewType-typed fields now generate correct snapshots that wrap the field value with the NewType constructor (e.g. Something(some_id=SomeID(1)) instead of Something(some_id=1)). This could only be fixed for Python >= 3.10.

0.32.5

13 Mar 18:35

Choose a tag to compare

Fixed

  • Fixed a bug where tuples used as snapshot keys caused problems because they had the same hash value (#358)

0.32.4

01 Mar 06:19

Choose a tag to compare

Added

  • Added context_managers parameter to Example.run_inline(), allowing tests to inject context managers (e.g. unittest.mock.patch) that are active during show_report().

Fixed

  • Fixed UsageError("unmanaged values can not be compared with snapshots") raised during session teardown when using -k to filter tests (#355). This was caused by inline-snapshot trying to update snapshots that were never compared. This is a rare edge case that caused problems when matchers were used, so it has been removed.

0.32.3

24 Feb 07:46

Choose a tag to compare

Changed

  • Improved performance of snapshot() by using lazy evaluation.

Fixed

  • Fixed code generation for Call objects created with builder.create_call().
  • use the handler for datetime types only for the concrete types and not the subclasses.

0.32.2

21 Feb 14:37

Choose a tag to compare

Fixed

  • Tuples in snapshots were converted internally into lists if they were evaluated more than once (#349)

0.32.1

17 Feb 12:06

Choose a tag to compare

Fixed

  • Fixed handling of datetime and time objects with timezone information. The tzinfo parameter is now properly included in snapshots, and timezone.utc is represented with the correct import (from datetime import timezone).

  • Fixed customize hook registration to properly check if objects are functions before inspecting the inline_snapshot_impl attribute, preventing potential attribute errors when scanning conftest modules.