Skip to content

Commit

Permalink
Fix no warning test
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 f5e46ef commit 1fdecb2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pvlib/tests/test__deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

from pvlib import _deprecation

import warnings


@pytest.fixture
def renamed_kwarg_func():
"""Returns a function decorated by renamed_kwarg_warning."""

@_deprecation.renamed_kwarg_warning(
"0.1.0", "old_kwarg", "new_kwarg", "0.2.0"
)
Expand All @@ -21,8 +24,10 @@ def func(new_kwarg):

def test_renamed_kwarg_warning(renamed_kwarg_func):
# assert no warning is raised when using the new kwarg
assert renamed_kwarg_func(new_kwarg=1) == 1 # as keyword argument
assert renamed_kwarg_func(1) == 1 # as positional argument
with warnings.catch_warnings():
warnings.simplefilter("error")
assert renamed_kwarg_func(new_kwarg=1) == 1 # as keyword argument
assert renamed_kwarg_func(1) == 1 # as positional argument

# assert a warning is raised when using the old kwarg
with pytest.warns(Warning, match="Parameter 'old_kwarg' has been renamed"):
Expand Down

0 comments on commit 1fdecb2

Please sign in to comment.