Added snippet that tests for whether an object is of a particular instance

This commit is contained in:
Donne Martin 2015-01-23 16:09:17 -05:00
parent 3c272027e1
commit 67b939f1bc

30
tests/test_util.py Normal file
View File

@ -0,0 +1,30 @@
from nose.tools import assert_equal
class TestUtil():
@classmethod
def setup_class(cls):
"""This method is run once for each class before any tests are run"""
@classmethod
def teardown_class(cls):
"""This method is run once for each class _after_ all tests are run"""
def setUp(self):
"""This method is run once before _each_ test method is executed"""
def teardown(self):
"""This method is run once after _each_ test method is executed"""
def test_isinstance(self):
assert_equal(isinstance(7, (int)), True)
assert_equal(isinstance(7.5, (int, float)), True)
assert_equal(isinstance('foo', (int, float, str)), True)
def main():
test = TestUtil()
test.test_isinstance()
if __name__ == "__main__":
main()