Advertising
Paste Description for Primeiro Python do PacMan
Não gosto de self, gosto de this :)
- Primeiro Python do PacMan
- Monday, September 15th, 2008 at 7:33:01am MDT
- #!/usr/bin/python
- import unittest
- class CalculadoraDeQuadrados:
- def quadradoDe(this,x):
- return x*x
- class TesteQuadrado(unittest.TestCase):
- def setUp(this):
- this.calc = CalculadoraDeQuadrados()
- def tearDown(this):
- this.calc = None
- def testQuadradoDeZero(this):
- this.assertEquals(0,this.calc.quadradoDe(0),"0^2 deveria ser 0")
- def testQuadradoDe3DeveriaSer9(this):
- this.assertEquals(9,this.calc.quadradoDe(3),"3^2 deveria ser 9")
- def testQuadradoDeMenos10DeveriaSer100(this):
- this.assertEquals(100,this.calc.quadradoDe(-10),"(-10)^2 deveria ser 100")
- unittest.main()
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.