Approvaltests

Latest version: v14.2.0

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

Scan your dependencies

Page 2 of 18

12.1.0

You can now add a reporter and both the previous and the new will launch. This is extra helpful with inline approvals

12.0.0

BREAKING CHANGE

python
verify(result, options=Options().inline(show_code=False))
verify(result, options=Options().inline(show_code=True))


is now

python
verify(result, options=Options().inline(InlineOptions.show_code(False)))
verify(result, options=Options().inline())


New Features in Inline Approvals

Semi-automatic Workflow

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


In this workflow, the docstring will be automatically updated, but with an extra line to be removed as approval.

Example:

Running this test:

python
def test_with_semi_automatic_inline_workflow():
verify("1\n2", options=Options().inline(InlineOptions.semi_automatic()))


Will automatically update the test source file to:

python
def test_with_semi_automatic_inline_workflow():
"""
1
2
***** DELETE ME TO APPROVE *****
"""
verify("1\n2", options=Options().inline(InlineOptions.semi_automatic()))


And as the last line suggests, when it is removed the test will start passing.

Fully Automatic Workflow

With this workflow, the extra line is not added.

python
def test_with_automatic_inline_workflow():
verify("1\n2", options=Options().inline(InlineOptions.automatic()))


Becomes:

python
def test_with_automatic_inline_workflow():
"""
1
2
"""
verify("1\n2", options=Options().inline(InlineOptions.automatic()))


Bug Fixes

**Fix 159:** would sometimes report approved and received as matching when they weren't. This usually only happened on cyberdojo with inline approvals,

11.2.1

11.2.0

Utilities to make it much easier to rapidly develop tests
[Read the How To](https://github.com/approvals/ApprovalTests.Python/blob/main/docs/how_to/inline_approvals_with_parse_input.md)

11.1.3

Fixed a bug with inline approvals where the input could not have preceding whitespace

11.1.2

- options.inline can now be created outside of the test method
- renamed `quiet_reporter` to `report_quietly`
- kept link to old name for backwards compatibility
- fixed bug in `quiet_reporter` and `InlineReporter` where they were throwing the wrong exception on failure

Page 2 of 18

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.