Exemple #1
0
 def test_catches_out_of_range_int_day_input(self):
     with pytest.raises(ValueError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5",
                                        "Single Carriageway", 0, -1, 0.3)
     with pytest.raises(ValueError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5",
                                        "Single Carriageway", 0, 7, 0.3)
Exemple #2
0
 def test_speed_comparison_kph_to_ms(self):
     assert rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3) * (1.0 / rb._MPH_TO_KPH) * rb._MPH_TO_MPS == \
            rb.get_speed_with_rainfall_ms("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3)
Exemple #3
0
 def test_throws_value_error_invalid_dow_string(self):
     with pytest.raises(ValueError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5",
                                        "Single Carriageway", 0, "Yaladay",
                                        0.3)
Exemple #4
0
 def test_case_of_dow_irrelevant(self):
     assert rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, "MoNDaY", 0.3) == \
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, "mOndAy", 0.3)
Exemple #5
0
 def test_throws_type_error_wrong_day_of_week_input(self):
     with pytest.raises(TypeError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5",
                                        "Single Carriageway", 0, 5., 0.3)
 def test_catches_out_of_range_int_day_input(self):
     with pytest.raises(ValueError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, -1, 0.3)
     with pytest.raises(ValueError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, 7, 0.3)
Exemple #7
0
 def test_catches_invalid_hour_type_input(self):
     with pytest.raises(TypeError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5",
                                        "Single Carriageway", "1", "Monday",
                                        0.3)
 def test_catches_invalid_hour_type_input(self):
     with pytest.raises(TypeError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", "1", "Monday", 0.3)
 def test_speed_comparison_kph_to_ms(self):
     assert rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3) * (1.0 / rb._MPH_TO_KPH) * rb._MPH_TO_MPS == \
            rb.get_speed_with_rainfall_ms("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3)
 def test_throws_value_error_invalid_dow_string(self):
     with pytest.raises(ValueError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, "Yaladay", 0.3)
 def test_case_of_dow_irrelevant(self):
     assert rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, "MoNDaY", 0.3) == \
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, "mOndAy", 0.3)
 def test_throws_type_error_wrong_day_of_week_input(self):
     with pytest.raises(TypeError):
         rb.get_speed_with_rainfall_kph("TEST_STREET5", "Single Carriageway", 0, 5., 0.3)