Last active
March 12, 2019 20:49
-
-
Save tonnydourado/3974123f338ee6e7ff2c194e14ec1f03 to your computer and use it in GitHub Desktop.
To mock or not
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
# Vai precisar mockar dependency pra testar my_function: | |
def dependency(param1, param2): | |
print(param1, param2) | |
def my_function(params): | |
# do things | |
if len(params) == 2: | |
dependency(*params) |
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
# Não vai precisar mockar dependency, só passar outra função | |
# pra testar, pode até ser uma função que não faz nada: | |
def dependency(param1, param2): | |
print(param1, param2) | |
def my_function(params, callback=dependency): | |
# do things | |
if len(params) == 2: | |
callback(*params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment