Why is 'isInstance' not defined?

Viewed 4957

I'm a TOTAL python rookie, but am trying to build a little Python utility on the side. I've built a unit test to test a basic setter, but my unit test fails with NameError: name 'isInstance' is not defined.

My silly little utility:

from pathlib import Path

class DirectoryStructureNormalizer:

    def __init__(self, path):
        self.path = path

    @property
    def path(self):
        return self.__path

    @path.setter
    def path(self, path):
        self.__path = Path(path)

And my unit test:

import unittest

from pathlib import Path

from DirectoryStructureNormalizer import DirectoryStructureNormalizer


class DirectoryStructureNormalizerTests(unittest.TestCase):

    def testSetterShouldSetPathToPathlibPath(self):
        directoryStructureNormalizer = DirectoryStructureNormalizer('.')
        self.assertTrue(isInstance(directoryStructureNormalizer.path, Path))

def main():
        unittest.main()

if __name__ == '__main__':
    main()

And finally, my output:

E
======================================================================
ERROR: testSetterShouldSetPathToPathlibPath (__main__.DirectoryStructureNormalizerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "DirectoryStructureNormalizerTests.py", line 12, in testSetterShouldSetPathToPathlibPath
    self.assertTrue(isInstance(directoryStructureNormalizer.path, Path))
NameError: name 'isInstance' is not defined

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)

I know I'm missing something super basic, but what?

0 Answers
Related