Skip to content

Inline approvals uses `InlineOptions`

Compare
Choose a tag to compare
@isidore isidore released this 28 Apr 19:49
· 113 commits to main since this release

BREAKING CHANGE

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

is now

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

New Features in Inline Approvals

Semi-automatic Workflow

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:

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

Will automatically update the test source file to:

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.

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

Becomes:

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,