def test_roundoff(): '''Test that roundoff works.''' assert to_celsius(100) == 38 # NOT 37.777...
def test_to_celsius(): '''Test function for to_celsius''' assert to_celsius(100) == 37.8
def test_freezing(): '''Test freezing point.''' assert to_celsius(32) == 0
def test_boiling(): '''Test boiling point.''' assert to_celsius(212) == 100
def test_to_celsius(): '''Test function for to_celsius''' assert to_celsius(100) == 37.8, 'Returning an unrounded result'
return math.sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2) F ====================================================================== FAIL: Test function for to_celsius ---------------------------------------------------------------------- Traceback (most recent call last): File "/python25/lib/site-packages/nose/case.py", line 202, in runTest self.test(*self.arg) File "assert2.py", line 6, in test_to_celsius assert to_celsius(100) == 37.8 AssertionError ---------------------------------------------------------------------- Ran 1 test in 0.000s FAILED (failures=1) F ====================================================================== FAIL: Test function for to_celsius ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\Python25\Lib\site-packages\nose\case.py", line 202, in runTest
def test_boiling(): '''沸点のテスト''' assert to_celsius(212) == 100
def test_roundoff(): ''' 四捨五入のテスト ''' assert to_celsius(100) == 38 # 37.777...ではなく
def test_roundoff(): '''四捨五入のテスト''' assert to_celsius(100) == 38
def test_freezing(): '''氷点のテスト''' assert to_celsius(32) == 0
def test_to_celsius(): '''to_celsiusのテスト関数''' assert to_celsius(100) == 37.8, '四捨五入されていない結果'
def test_to_celsius(): '''to_celsiusのテスト関数''' assert to_celsius(100) == 37.8