def testConversionKelvinToFahrenheit(self): for celsius, fahrenheit, kelvin in conversionInfo.conversiontable: print( 'Validating {} degrees Kelvin converts to {} degrees Fahrenheit' .format(kelvin, fahrenheit)) result = conversions.convertKelvintoFahrenheit(kelvin) self.assertEqual(fahrenheit, round(result, 2))
def test_kf_function(self): with self.assertRaises(TypeError, msg='Getting an incorrect type ' 'should raise a TypeError'): conversions.convertKelvintoFahrenheit(999) cases = ( (773.15, 932.00), (763.15, 914.00), (273.15, 32.00), (263.15, 14.00), (0.00, -459.67), ) for k, f in cases: result = conversions.convertKelvintoFahrenheit(k) self.assertEqual(result, f, msg=f'Test case failed: K:{k} F:{f}')
def test_largepos(self): result5 = convertKelvintoFahrenheit(self.temp5) self.assertEqual(result5, 1762.448)
def test_largeneg(self): result4 = convertKelvintoFahrenheit(self.temp4) self.assertEqual(result4, -9459.94)
def test_decimal(self): result2 = convertKelvintoFahrenheit(self.temp2) self.assertEqual(result2, -279.364)
def test_simple(self): result1 = convertKelvintoFahrenheit(self.temp1) self.assertAlmostEqual(result1, 80.24, 2)