Exemplo n.º 1
0
 def test_temperature_change(self):
     havana = City("Havana", 25, 70)
     helsinki = City("Helsinki", -10, 50)
     havana.change_temperature(45)
     self.assertEqual(
         havana.get_temperature_in_celsius() -
         helsinki.get_temperature_in_celsius(), 55)
Exemplo n.º 2
0
 def test_return_type_4(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(int, type(havana.get_temperature_in_kelvins()))
Exemplo n.º 3
0
 def test_return_type_3(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(int, type(havana.get_temperature_in_fahrenheit()))
Exemplo n.º 4
0
 def test_return_type_2(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(int, type(havana.get_moisture()))
Exemplo n.º 5
0
 def test_wrong_argument_4(self):
     with self.assertRaises(TypeError):
         havana = City("Havana", 25, 70)
         havana.change_temperature((5, 6))
Exemplo n.º 6
0
 def test_temperature_in_celsius(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(havana.get_temperature_in_celsius(), 25)
Exemplo n.º 7
0
 def test_temperature_in_kelvin(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(
         havana.get_temperature_in_kelvins(),
         cs.get_kelvin_from_celsius(havana.get_temperature_in_celsius()))
Exemplo n.º 8
0
 def test_city_name(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(havana.get_city_name(), "Havana")
Exemplo n.º 9
0
 def test_wrong_argument_1(self):
     with self.assertRaises(ValueError):
         havana = City("Havana", 25, 70)
         havana.change_moisture("$")
Exemplo n.º 10
0
 def test_wrong_input_2(self):
     with self.assertRaises(TypeError):
         City("Athens", 20, (1, True))
Exemplo n.º 11
0
 def test_wrong_input_1(self):
     with self.assertRaises(ValueError):
         City("Monte-Carlo", "temp", 45)
Exemplo n.º 12
0
 def test_moisture_change(self):
     havana = City("Havana", 25, 70)
     helsinki = City("Helsinki", -10, 50)
     havana.change_moisture(100)
     self.assertEqual(havana.get_moisture() - helsinki.get_moisture(), 50)
Exemplo n.º 13
0
 def test_moisture(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(havana.get_moisture(), 70)
Exemplo n.º 14
0
 def test_temperature_in_fahrenheit(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(havana.get_temperature_in_fahrenheit(), 77)
Exemplo n.º 15
0
 def test_return_type_5(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(str, type(havana.get_city_name()))
Exemplo n.º 16
0
 def test_wrong_argument_2(self):
     with self.assertRaises(ValueError):
         havana = City("Havana", 25, 70)
         havana.change_temperature("&")
Exemplo n.º 17
0
 def test_return_type_6(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(tuple, type(havana.make_prediction()))
Exemplo n.º 18
0
 def test_wrong_argument_3(self):
     with self.assertRaises(TypeError):
         havana = City("Havana", 25, 70)
         havana.change_moisture([1, 2, "sda"])
Exemplo n.º 19
0
 def test_make_prediction(self):
     havana = City("Havana", 25, 70)
     self.assertEqual(havana.make_prediction(), (50.0, 70.0))
Exemplo n.º 20
0
from lib import City


city_list = ["Vladivostok", "Moscow"]
city_dict = {city_list[0]: City(city_list[0], 15, 70), city_list[1]: City(city_list[1], 20, 40)}