Skip to content

Commit

Permalink
adding deprecation documentation for boolean positional keyword argum…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
bandophahita committed Feb 8, 2024
1 parent 0dbaf38 commit 66b77b4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
80 changes: 80 additions & 0 deletions docs/deprecations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
============
Deprecations
============

This page documents
the major deprecations
in ScreenPy Selenium's life,
and how to adjust your tests
to keep them up to date.

4.1.0 Deprecations
==================

Boolean Positional Arguments Deprecation
----------------------------------------

The following class constructors
have been marked deprecated
when using a positional boolean argument in the constructor.
Starting with version 5.0.0
you will be required to provide keywords
for the following boolean arguments.

:class:`~screenpy_selenium.actions.enter.Enter`

Before::

the_actor.will(Enter("foo", True).into_the(PASSWORD))

After::

the_actor.will(Enter("foo", mask=True).into_the(PASSWORD))


:class:`~screenpy_selenium.actions.hold_down.HoldDown`

Before::

the_actor.will(Chain(HoldDown(None, True))

After::

the_actor.will(Chain(HoldDown(None, lmb=True))
the_actor.will(Chain(HoldDown(lmb=True))

:class:`~screenpy_selenium.actions.release.Release`

Before::

the_actor.will(Release(None, True))

After::

the_actor.will(Release(None, lmb=True))
the_actor.will(Release(lmb=True))


:class:`~screenpy_selenium.questions.selected.Selected`

Before::

the_actor.shall(See.the(Selected(TARGET, True), IsEmpty()))

After::

the_actor.shall(See.the(Selected(TARGET, multi=True), IsEmpty()))


:class:`~screenpy_selenium.questions.text.Text`

Before::

the_actor.shall(See.the(Text(TARGET, True), IsEqual("foo"))

After::

the_actor.shall(See.the(Text(TARGET, multi=True), IsEqual("foo")


1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ to :class:`~screenpy_selenium.abilities.BrowseTheWeb`!
extended_api
targets
cookbook
deprecations
4 changes: 2 additions & 2 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def new_method(self) -> bool:

def test_positional_arg_warns(self) -> None:
with pytest.warns(DeprecationWarning):
HoldDown(Keys.LEFT_ALT, True)
HoldDown(None, True)

def test_keyword_arg_does_not_warn(self) -> None:
with warnings.catch_warnings():
Expand Down Expand Up @@ -913,7 +913,7 @@ def new_method(self) -> bool:

def test_positional_arg_warns(self) -> None:
with pytest.warns(DeprecationWarning):
Release(Keys.LEFT_ALT, True)
Release(None, True)

def test_keyword_arg_does_not_warn(self) -> None:
with warnings.catch_warnings():
Expand Down

0 comments on commit 66b77b4

Please sign in to comment.