Skip to content

Commit

Permalink
test-driven-development for the win: unchanged remain properties
Browse files Browse the repository at this point in the history
Co-Authored-By: Kevin Anderson <[email protected]>
  • Loading branch information
echedey-ls and kandersolar committed Oct 2, 2024
1 parent 65e144b commit fd0974f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pvlib/tests/test__deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,25 @@

@pytest.fixture
def renamed_kwarg_func():
"""Returns a function decorated by renamed_kwarg_warning."""
"""Returns a function decorated by renamed_kwarg_warning.
This function is called 'func' and has a docstring equal to 'docstring'.
"""

@_deprecation.renamed_kwarg_warning(
"0.1.0", "old_kwarg", "new_kwarg", "0.2.0"
)
def func(new_kwarg):
"""docstring"""
return new_kwarg

return func


def test_renamed_kwarg_warning(renamed_kwarg_func):
# assert decorated function name and docstring are unchanged
assert renamed_kwarg_func.__name__ == "func"
assert renamed_kwarg_func.__doc__ == "docstring"

# assert no warning is raised when using the new kwarg
with warnings.catch_warnings():
warnings.simplefilter("error")
Expand Down

0 comments on commit fd0974f

Please sign in to comment.