Esempio n. 1
0
    def test_init_with_invalid_adress(self):
        """Check that init returns an error when entering an invalid parameter"""

        with self.assertRaises(TypeError):
            dcc_trains.Train("DCC1", "ad")
Esempio n. 2
0
 def test_f2_with_valid_parameter(self):
     """Test that the f2 function work when a valid parameter is given"""
     dcc_trains.Train("DCC4", 4).f2 = False
Esempio n. 3
0
 def test_f3_with_invalid_parameter(self):
     """Test that the f3 function return an error when an invalid parameter is given"""
     with self.assertRaises(TypeError):
         dcc_trains.Train("DCC8", 8).f2 = " /"
Esempio n. 4
0
 def test_f1_with_invalid_parameter(self):
     """Test that the f1 function return an error when an invalid parameter is given"""
     with self.assertRaises(TypeError):
         dcc_trains.Train("DCC4", 4).f1 = "hzdlu"
Esempio n. 5
0
 def test_f_light_with_valid_parameter(self):
     """Test that the fl function work when a valid parameter is given"""
     dcc_trains.Train("DCC4", 4).fl = True
Esempio n. 6
0
 def test_set_speed_with_valid_parameter(self):
     """ Test that the set_speed function work when a valid parameter is given"""
     dcc_trains.Train("DCC6", 6).speed = 10
Esempio n. 7
0
 def test_set_speed_with_invalid_parameter(self):
     """ Test that the set_speed function return an error when inavlid parameter is given"""
     with self.assertRaises(TypeError):
         dcc_trains.Train("DCC3", 3).speed = "gas"
Esempio n. 8
0
 def test_init_with_valid_adress_name(self):
     """ Test that the init function works when a correct adress and name are  given"""
     dcc_trains.Train("DCC4", 4)