Exemple #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")
Exemple #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
Exemple #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 = " /"
Exemple #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"
Exemple #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
Exemple #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
Exemple #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"
Exemple #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)