Exemplo n.º 1
0
 def test_get_speed_with_rainfall_mph_avg_speed_always_constant(self):
     assert numpy.isclose(
         rb.get_speed_with_rainfall_mph("TEST_STREET3", "Dual Carriageway",
                                        5, "Monday", 0.1), 35.9989)
     assert numpy.isclose(
         rb.get_speed_with_rainfall_mph("TEST_STREET3", "Dual Carriageway",
                                        16, "Monday", 0.8), 35.9989)
Exemplo n.º 2
0
 def test_throws_value_error_when_road_does_not_contain_inputted_nature(
         self):
     with pytest.raises(ValueError):
         assert rb.get_speed_with_rainfall_mph("TEST_STREET2",
                                               "Dual Carriageway", 5,
                                               "Monday", 0)
Exemplo n.º 3
0
 def test_get_speed_no_rainfall_same_as_0_depth(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0) == \
            rb.get_speed_without_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday")
Exemplo n.º 4
0
 def test_day_of_week_int_or_string(self):
     assert rb.get_speed_with_rainfall_mph("test_street1", "Dual Carriageway", 5, "Monday", 0) == \
            rb.get_speed_with_rainfall_mph("test_street1", "Dual Carriageway", 5, 1, 0)
Exemplo n.º 5
0
 def test_get_speed_with_rainfall_mph(self):
     # Test the calculations are working correctly
     assert numpy.isclose(
         rb.get_speed_with_rainfall_mph("TEST_STREET3",
                                        "Single Carriageway", 5, "Monday",
                                        0.1), 11.709)
 def test_get_speed_with_rainfall_mph_avg_speed_always_constant(self):
     assert numpy.isclose(rb.get_speed_with_rainfall_mph("TEST_STREET3", "Dual Carriageway", 5, "Monday", 0.1), 35.9989)
     assert numpy.isclose(rb.get_speed_with_rainfall_mph("TEST_STREET3", "Dual Carriageway", 16, "Monday", 0.8), 35.9989)
Exemplo n.º 7
0
 def test_road_uppercase_or_lower_case_irrelevant(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET1", "Dual Carriageway", 5, "Monday", 0) == \
         rb.get_speed_with_rainfall_mph("test_street1", "Dual Carriageway", 5, "Monday", 0)
 def test_road_uppercase_or_lower_case_irrelevant(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET1", "Dual Carriageway", 5, "Monday", 0) == \
         rb.get_speed_with_rainfall_mph("test_street1", "Dual Carriageway", 5, "Monday", 0)
 def test_day_of_week_int_or_string(self):
     assert rb.get_speed_with_rainfall_mph("test_street1", "Dual Carriageway", 5, "Monday", 0) == \
            rb.get_speed_with_rainfall_mph("test_street1", "Dual Carriageway", 5, 1, 0)
Exemplo n.º 10
0
 def test_speed_comparison_mph_to_ms(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3) * rb._MPH_TO_MPS == \
            rb.get_speed_with_rainfall_ms("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3)
Exemplo n.º 11
0
 def test_nature_approximation(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3) == \
         rb.get_speed_with_rainfall_mph("TEST_STREET5", "SinGllle Carriagewway", 5, "Monday", 0.3)
     assert rb.get_speed_with_rainfall_mph("TEST_STREET1", "Dual Carriageway", 5, "Monday", 0) == \
         rb.get_speed_with_rainfall_mph("TEST_STREET1", "Dual Cawy", 5, "Monday", 0)
Exemplo n.º 12
0
 def test_api_catches_increasing_model_and_return_0_depth_instead(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET2", "Single Carriageway", 5, "Monday", 0.1) == \
            rb.get_speed_without_rainfall_mph("TEST_STREET2", "Single Carriageway", 5, "Monday")
Exemplo n.º 13
0
 def test_throws_value_error_when_road_does_not_contain_inputted_nature(self):
     with pytest.raises(ValueError):
         assert rb.get_speed_with_rainfall_mph("TEST_STREET2", "Dual Carriageway", 5, "Monday", 0)
Exemplo n.º 14
0
 def test_get_speed_no_rainfall_same_as_0_depth(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0) == \
            rb.get_speed_without_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday")
Exemplo n.º 15
0
 def test_api_catches_increasing_model_and_return_0_depth_instead(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET2", "Single Carriageway", 5, "Monday", 0.1) == \
            rb.get_speed_without_rainfall_mph("TEST_STREET2", "Single Carriageway", 5, "Monday")
Exemplo n.º 16
0
 def test_nature_approximation(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3) == \
         rb.get_speed_with_rainfall_mph("TEST_STREET5", "SinGllle Carriagewway", 5, "Monday", 0.3)
     assert rb.get_speed_with_rainfall_mph("TEST_STREET1", "Dual Carriageway", 5, "Monday", 0) == \
         rb.get_speed_with_rainfall_mph("TEST_STREET1", "Dual Cawy", 5, "Monday", 0)
Exemplo n.º 17
0
 def test_speed_comparison_mph_to_ms(self):
     assert rb.get_speed_with_rainfall_mph("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3) * rb._MPH_TO_MPS == \
            rb.get_speed_with_rainfall_ms("TEST_STREET5", "Single Carriageway", 5, "Monday", 0.3)
Exemplo n.º 18
0
 def test_get_speed_with_rainfall_mph(self):
     # Test the calculations are working correctly
     assert numpy.isclose(rb.get_speed_with_rainfall_mph("TEST_STREET3", "Single Carriageway", 5, "Monday", 0.1), 11.709)