def test_6(self):
     Temperature.set_default_scale("f")
     t = Temperature("100")
     self.assertEquals(str(t), "100F")
     Temperature.set_default_scale("k")
     t = Temperature("-50")
     self.assertEquals(str(t), "-50K")
Beispiel #2
0
 def test_6(self):
     Temperature.set_default_scale("f")
     t = Temperature("100")
     self.assertEquals(str(t), "100F")
     Temperature.set_default_scale("k")
     t = Temperature("-50")
     self.assertEquals(str(t), "-50K")
Beispiel #3
0
 def test_6(self):
     Temperature.set_default_scale("k")
     t1 = Temperature("10")
     t2 = Temperature("20")
     t3 = t1 - t2
     t4 = t2 - t3
     t5 = t3 - t4
     for i in range(1, 6):
         self.assertEquals(str(eval("t" + str(i)))[-1], "K")
     self.assertEquals(t1.dvalue, 10)
     self.assertEquals(t2.dvalue, 20)
     self.assertEquals(t3.dvalue, -10)
     self.assertEquals(t4.dvalue, 30)
     self.assertEquals(t5.dvalue, -40)
Beispiel #4
0
 def test_6(self):
     Temperature.set_default_scale("f")
     t1 = Temperature("1")
     t2 = Temperature("2")
     t3 = t1 + t2
     t4 = t2 + t3
     t5 = t3 + t4
     for i in range(1, 6):
         self.assertEquals(str(eval("t" + str(i)))[-1], "F")
     self.assertEquals(t1.dvalue, 1)
     self.assertEquals(t2.dvalue, 2)
     self.assertEquals(t3.dvalue, 3)
     self.assertEquals(t4.dvalue, 5)
     self.assertEquals(t5.dvalue, 8)
 def test_6(self):
     Temperature.set_default_scale("f")
     t1 = Temperature("1")
     t2 = Temperature("2")
     t3 = t1 + t2
     t4 = t2 + t3
     t5 = t3 + t4
     for i in range(1, 6):
         self.assertEquals(str(eval("t"+str(i)))[-1], "F")
     self.assertEquals(t1.dvalue, 1)
     self.assertEquals(t2.dvalue, 2)
     self.assertEquals(t3.dvalue, 3)
     self.assertEquals(t4.dvalue, 5)
     self.assertEquals(t5.dvalue, 8)
 def test_6(self):
     Temperature.set_default_scale("k")
     t1 = Temperature("10")
     t2 = Temperature("20")
     t3 = t1 - t2
     t4 = t2 - t3
     t5 = t3 - t4
     for i in range(1, 6):
         self.assertEquals(str(eval("t"+str(i)))[-1], "K")
     self.assertEquals(t1.dvalue, 10)
     self.assertEquals(t2.dvalue, 20)
     self.assertEquals(t3.dvalue, -10)
     self.assertEquals(t4.dvalue, 30)
     self.assertEquals(t5.dvalue, -40)
Beispiel #7
0
 def setUp(self):
     Temperature.set_default_scale("C")
Beispiel #8
0
 def test_type_error3(self):  # not a str
     with self.assertRaises(TypeError):
         Temperature.set_default_scale(6)
Beispiel #9
0
 def setUp(self):
     self.__oldDefaultScale = Temperature.DEFAULT_SCALE
     Temperature.set_default_scale("C")
 def tearDown(self):
     Temperature.set_default_scale(self.__oldDefaultScale)
 def setUp(self):
     self.__oldDefaultScale = Temperature.DEFAULT_SCALE
     Temperature.set_default_scale("C")
 def test_value_error3(self):  # not in ["c", "C", "f", "F", "k", "K"]
     with self.assertRaises(ValueError):
         Temperature.set_default_scale("a")
 def test_value_error2(self):  # not a single char str
     with self.assertRaises(ValueError):
         Temperature.set_default_scale("")
 def setUp(self):
     Temperature.set_default_scale("C")
 def test_type_error3(self):  # not a str
     with self.assertRaises(TypeError):
         Temperature.set_default_scale(6)
Beispiel #16
0
 def test_value_error2(self):  # not a single char str
     with self.assertRaises(ValueError):
         Temperature.set_default_scale("")
Beispiel #17
0
 def test_value_error3(self):  # not in ["c", "C", "f", "F", "k", "K"]
     with self.assertRaises(ValueError):
         Temperature.set_default_scale("a")
 def test_C(self):
     Temperature.set_default_scale("C")
     self.assertEquals(Temperature.DEFAULT_SCALE, 'C')
Beispiel #19
0
 def tearDown(self):
     Temperature.set_default_scale(self.__oldDefaultScale)
Beispiel #20
0
 def test_2(self):
     Temperature.set_default_scale("F")
     t = Temperature(32)
     self.assertEquals(str(t), "32F")
     t.scale = "c"
     self.assertEquals(t.scale, "C")
Beispiel #21
0
 def test_C(self):
     Temperature.set_default_scale("C")
     self.assertEquals(Temperature.DEFAULT_SCALE, 'C')
 def test_2(self):
     Temperature.set_default_scale("F")
     t = Temperature(32)
     self.assertEquals(str(t), "32F")
     t.scale = "c"
     self.assertEquals(t.scale, "C")