title: How to do unit testing on Image as input and output in python?
body: <p>I am doing unit testing on object detection <a href="https://stackoverflow.com/questions/54576667/how-can-i-correctly-classify-the-number-of-positive-bright-color-circles-and-n">code</a> (accepted answer) in Python. I know that in unit testing, we basically put in test parameters to functions we have defined in our program and we enter the expected result. If the expected result is output, we get OK, otherwise, we will get an error.</p>
  
  <p>So my problem is that my <strong>input</strong> is the <strong>Image</strong> and my <strong>output</strong> is the also an image (i.e. <strong>object detected in the image</strong>) and later on, the result is represented using the bar chart and the histogram with slider. <strong>How can I do unit testing on such data?</strong></p>
  
  <p>So far, this is what I have tried (This <a href="https://stackoverflow.com/questions/54576667/how-can-i-correctly-classify-the-number-of-positive-bright-color-circles-and-n">code</a> is saved as cirCode)</p>
  
  <pre><code>from unittest import TestCase
  
  import unittest
  from unittest import TestCase
  import cirCode
  
  class TestFind_circles(TestCase):
  
          def setUp(self):
              pass
  
          def tearDown(self):
              pass
  
          #def test_circle(self):
           #   self.fail()
  
          def test_find_circles(self):
  
              Negative_circles, Positive_circles, out_filepath, circles, threshold = cirCode.find_circles('blobs.jpg')
  
              self.assertEqual(Negative_circles, 20)
              self.assertEqual(Positive_circles, 8)
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>Now, I do not know how to test <strong>def circle</strong> function. Also, I am not sure if it is a correct way to test <strong>find_circles</strong> function. </p>
  
  <p>Do you guys have any better idea to do the unit test on this <a href="https://stackoverflow.com/questions/54576667/how-can-i-correctly-classify-the-number-of-positive-bright-color-circles-and-n">code</a> and also how can I proceed with the unit test on the <em>circle</em> function?</p>