Created
March 12, 2021 15:18
-
-
Save freelancing-solutions/1cefc6c2bd5acf23eed67398d3f08a81 to your computer and use it in GitHub Desktop.
Python Testing Value Types
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
# Program Flow Testing | |
if not isinstance(value,str): | |
raise TypeError('value is not a string') | |
if not isinstance(value,int): | |
raise TypeError('value is not an Integer') | |
# While running Tests NOTE you should install pytest in configure test cases like this | |
assert isinstance(value,str), "Value can only be a string" | |
assert isinstance(value,int), "Value can only be an integer" | |
# TO learn how to install pytest and configure your testing environment see | |
# https://gists.github.com/freelance-solutions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
learn how to setup test cases here
https://gist.github.com/freelancing-solutions/10edc55038ce2a48c485b16fdbdc69a3