Approvaltests

Latest version: v12.0.0

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

Scan your dependencies

Page 2 of 17

11.1.0

You can now do this:
python
def test_with_labeled_input(self) -> None:
verify_all_combinations_with_labeled_input(
lambda a,b: a+b+1,
arg1=(1, 3),
arg2=(2, 4),
)


and it will produce:

text
(arg1: 1, arg2: 2) => 4
(arg1: 1, arg2: 4) => 6
(arg1: 3, arg2: 2) => 6
(arg1: 3, arg2: 4) => 8

11.0.0

Breaking Change
verify_all with an empty head will no longer add 2 blank lines at the beginning of the file

10.4.0

This allows for inline approvals to get the inputs from the approved docstring.
(more coming soon)
Here's an example where the inputs (a,b,c) are gathered from the docstring:

from approvaltests.inline.parse_docstring import parse_docstring

def test_uppercase():
"""
a -> A
b -> B
c -> C
"""
verify("\n".join([ f"{a} -> {a.upper()}" for a in parse_docstring()]), options=Options().inline())

10.3.0

Fixes 155

by default pytest requires your functions to start with `test_`

this is configurable in pytest was not supported by Approval Tests
it is now supported in Approval Tests

10.2.0

10.1.0

You can now use inline approvals by adding

python
verify(result, options=Options().inline())


This will use the test method docstring as the expected result instead of a separate `.approved.txt` file.

The current reporter has limited support for Python, it will be improved.

Page 2 of 17

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.