Skip to content

Commit

Permalink
fix: update test to check that the decorator is returning
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
  • Loading branch information
victorgarcia98 committed May 11, 2023
1 parent 43cf12e commit 583bd28
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions flexmeasures/utils/tests/test_coding_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@


def other_function():
pass
return 1


def test_deprecated_decorator(caplog, app):

# defining a function that is deprecated
@deprecated(other_function, "v14")
def deprecated_function():
pass
return other_function()

caplog.clear()

deprecated_function() # calling a deprecated function
value = deprecated_function() # calling a deprecated function
print(caplog.records)
assert len(caplog.records) == 1 # only 1 warning being printed

Expand All @@ -25,3 +25,7 @@ def deprecated_function():
assert "v14" in str(
caplog.records[0].message
) # checking that the message is correct

assert (
value == 1
) # check that the decorator is returning the value of `other_function`

0 comments on commit 583bd28

Please sign in to comment.