[Tutor] unittest skipping tests
Peter Otten
__peter__ at web.de
Thu Aug 1 15:47:59 CEST 2013
Matthew Ngaha wrote:
> Thanks guys. i was following some examples and noticed it. I tried to
> use it in my program and the same thing happened. In this example,
> there are 6 tests, and only 4 run.
class TestAverage(unittest.TestCase):
[...]
def test_python30_mine(self):
self.assertRaises(ZeroDivisionError,
average,
[5])
[...]
#although sum is Zero, the length is not Zero
def test_python30_mine(self):
self.assertRaises(ZeroDivisionError,
average,
[0])
You need a different name for every method. That's the same situation as
x = "foo"
x = "bar"
print(x) # there's no way to find the previous value of x
Python's 'def' is executable code similar to an assignment, basically
def f(): ...
makes a function object and binds it to the name 'f'.
More information about the Tutor
mailing list