Below program:
import unittest
class my_class(unittest.TestCase):
  def setUp(self):
        print "In Setup"
        self.x=100
        self.y=200
    def test_case1(self):
        print "-------------"
        print "test case1"
        print self.x
        print "-------------"
    def test_case2(self):
        print "-------------"
        print "test case2"
        print self.y
        print "-------------"
    def tearDown(self):
        print "In Tear Down"
        print "      "
        print "      "
if __name__ == "__main__":
    unittest.main()
Gives the output:
>>> ================================ RESTART ================================
>>> 
In Setup
-------------
test case1
100
-------------
In Tear Down
.In Setup
-------------
test case2
200
-------------
In Tear Down
      .
----------------------------------------------------------------------
Ran 2 tests in 0.113s
OK
>>> 
>>> 
Questions:
- what's the meaning of: - if __name__ == "__main__": unittest.main()?
- Why do we have double underscores prefixed and postfixed for - nameand- main?
- Where will the object for - my_classbe created?
 
     
     
    