---
title: "💭 inline-snapshot"
description: "!https://15r10nk.github.io/inline-snapshot/"
date: 2024-04-17
published: true
tags:
  - python
  - testing
  - thought
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://15r10nk.github.io/inline-snapshot/" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">Redirecting</div>
      <div class="embed-card-meta">15r10nk.github.io</div>
    </div>
  </a>
</div>


This is a cool snapshot testing tool that automatically creates, and updates test values for you.

Starting with some test code.

``` python
from inline_snapshot import snapshot


def something():
    return 1548 * 18489


def test_something():
    assert something() == snapshot()
```

now if I run `pytest` my tests will fail because my assert will fail, but if I run `pytest --inline-snapshot=create` it will fill out my snapshot values and the file will then look like this.

``` python
from inline_snapshot import snapshot


def something():
    return 1548 * 18489


def test_something():
    assert something() == snapshot(28620972)
```

!!! note

    This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make
    about someone else's content online <a href="/tags/thoughts/" class="hashtag-tag" data-tag="thoughts" data-count=2 data-reading-time=3 data-reading-time-text="3 minutes">#thoughts</a>
