title: Using Python's unittest module to test return values from instance methods of a class
body: <pre><code>class Solution:
  
      def addNums(self, a, b):
          return a + b
  
  test1 = Solution()   
  test1.addNums(5, 6)
  </code></pre>
  
  <p>The above is my class! With a simple add method.</p>
  
  <p>Essentially, what I'm trying to do is, prepare for Algorithms and Data Structures/Programming Interviews, where I create instance for each input and want to write unit tests for instances..</p>
  
  <p>Here is what I've tried below:</p>
  
  <pre><code>import unittest
  
  class TestSolution(unittest.TestCase):
  
      def test_addNums(self):
          example = Solution()  
          self.assertEqual(example.addNums(9, 10), 19)
  
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>Not sure how to go about doing this, if I run the above code, I get this error message:</p>
  
  <pre><code>----------------------------------------------------------------------
  AttributeError: module '__main__' has no attribute '/Users/abhishekbabuji/Library/Jupyter/runtime/kernel-eb5f1d39-4880-49a7-9355-bbddc95464ff'
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.001s
  
  FAILED (errors=1)
  An exception has occurred, use %tb to see the full traceback.
  
  SystemExit: True
  </code></pre>
  
  <p>I want to be able to test return values of an instance method of a <code>Solution</code> class, in this case <code>addNums(self, a, b)</code></p>