Approvaltests

Latest version: v12.0.0

Safety actively analyzes 625681 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 13 of 17

3.0.0

Breaking Change

verify_file("sample.xml") will produce an approval file with an .xml extension

verify_file("sample.xml",options=Options().for_file.with_extension(".json")) will produce an approval file with an .json extension

2.2.0

Added support for [DiffEngineTray](https://github.com/VerifyTests/DiffEngine/blob/main/docs/tray.md)

2.1.0

verify_as_json` can now take an optional parameter `deserialize_json_fields` which if True will produce nicer formatted output.

json
{
"type": "dictionary",
"value": "{\"a\": 1, \"b\": 2, \"c\": 3}"
}


vs

json
{
"type": "dictionary",
"value": {
"a": 1,
"b": 2,
"c": 3
}
}

2.0.0

Create regex scrubber
Renamed `scrub_with_regex` to `create_regex_scrubber`.
It can now take either a `str` or a `Callable[[int], str]`

Going forward, functions that return scrubber will start with `create` while functions that scrub directly will start with `scrub`

1.1.0

Why Use Storyboards

Sometimes we might want to see different steps in a workflow or lifetime of an object. Storyboards are a convenience object to help enable that.

Approvaltests allows us to look at a complete object instead of just pieces of it. Storyboards allow us to track an object through time.

The mechanism to map time to space that storyboards use is very analogous to a comic book, but with each frame vertically after each other so that it works well with the diff tool and shows a progression.

How To Use Storyboards

Here is example of creating story board, adding content to it, and verifying it.

<!-- snippet: use_storyboard -->
<a id='snippet-use_storyboard'></a>
py
story = Storyboard()
story.add_description("Spinning wheel")
story.add_frame(ascii_wheel)
ascii_wheel.advance()
story.add_frame(ascii_wheel)
verify(story)

<!-- endSnippet -->

will produce

<!-- snippet: VerifyTests.test_simple_storyboard.approved.txt -->
<a id='snippet-VerifyTests.test_simple_storyboard.approved.txt'></a>
txt
Spinning wheel

Initial:
-

Frame 1:
\

<!-- endSnippet -->

1.0.1

A bug with the namer was introduced which is now fixed. No other changes

Page 13 of 17

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.