Last active
March 23, 2019 23:27
-
-
Save rishabh-ink/d757a732d674945b361244f12e55a720 to your computer and use it in GitHub Desktop.
Of pytest and lru_cache in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest import mock | |
import pytest | |
@pytest.mark.parametrize( | |
'ordinary_object', | |
[ | |
'quill', | |
'cushion', | |
'cauldron', | |
], | |
) | |
def test_levitate_casts_a_spell(ordinary_object): | |
with mock.patch( | |
'levitation.cast_spell', | |
autospec=True, | |
) as patched_cast_spell: | |
levitate.cache_clear() | |
levitate(ordinary_object) | |
patched_cast_spell.assert_called_once_with(target=ordinary_object) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment