test_sample.py
# coding: utf-8
from unittest import TestCase
from nose.tools import eq_
class SampleTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_sample(self):
"""
Test sample
"""
for i in xrange(3):
yield eq_, True, False
Even so
$ nosetests -s -v test_sample.py
Test sample... ok
----------------------------------------------------------------------
Ran 1 tests in 0.001s
It didn't work as expected.
Corrected as below,
test_sample.py
# coding: utf-8
from nose.tools import eq_
def test_sample():
"""
Test sample
"""
for i in xrange(3):
yield eq_, True, False
Then
$ nosetests -s -v test_sample.py
Test sample... FAIL
Test sample... FAIL
Test sample... FAIL
======================================================================
FAIL:Test sample
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/numpy/1.9.2/libexec/nose/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
AssertionError: True != False
======================================================================
FAIL:Test sample
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/numpy/1.9.2/libexec/nose/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
AssertionError: True != False
======================================================================
FAIL:Test sample
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/numpy/1.9.2/libexec/nose/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
AssertionError: True != False
----------------------------------------------------------------------
Ran 3 tests in 0.011s
FAILED (failures=3)
It worked as expected.
Goodbye, nose. I'm going to go to pytest ... artigatougozaimashita.
Recommended Posts