Last active
August 29, 2015 14:07
-
-
Save edgabaldi/f33354497f978918f5b2 to your computer and use it in GitHub Desktop.
patch example
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
import random | |
from unittest import TestCase | |
from mock import patch | |
def get_age(): | |
return random.randint(15, 99) | |
class AgeTest(TestCase): | |
@patch('patch_example.random.randint') | |
def test_gen_age(self, _func): | |
get_age() | |
_func.assert_called_once_with(15, 99) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment