Skip to content

Instantly share code, notes, and snippets.

@freelancing-solutions
Created March 12, 2021 15:18
Show Gist options
  • Save freelancing-solutions/1cefc6c2bd5acf23eed67398d3f08a81 to your computer and use it in GitHub Desktop.
Save freelancing-solutions/1cefc6c2bd5acf23eed67398d3f08a81 to your computer and use it in GitHub Desktop.
Python Testing Value Types
# 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
@freelancing-solutions
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment