実験
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):
"""
テストサンプル
"""
for i in xrange(3):
yield eq_, True, False
しても、
$ nosetests -s -v test_sample.py
テストサンプル ... ok
----------------------------------------------------------------------
Ran 1 tests in 0.001s
みたいになって期待通りには動いてくれなかった。
下記のように修正、
test_sample.py
# coding: utf-8
from nose.tools import eq_
def test_sample():
"""
テストサンプル
"""
for i in xrange(3):
yield eq_, True, False
すると、
$ nosetests -s -v test_sample.py
テストサンプル ... FAIL
テストサンプル ... FAIL
テストサンプル ... FAIL
======================================================================
FAIL: テストサンプル
----------------------------------------------------------------------
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: テストサンプル
----------------------------------------------------------------------
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: テストサンプル
----------------------------------------------------------------------
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)
みたいにちゃんと期待通りに動いた。
nose さん、さようなら。 pytest さんのところに行こうと思います…。
artigatougozaimashita.