diff --git a/tests/fixtures/mesan/multipoint.txt b/tests/fixtures/mesan/multipoint.txt index c2354a90..c8f1dbd1 100644 --- a/tests/fixtures/mesan/multipoint.txt +++ b/tests/fixtures/mesan/multipoint.txt @@ -15,4 +15,4 @@ Via: 1.1 varnish (Varnish/6.6) X-Varnish: 681874038 X-hits: 0 -{"approvedTime":"2024-03-31T08:39:25Z","referenceTime":"2024-03-31T08:00:00Z","geometry":{"type":"MultiPoint","coordinates":[[2.250475,52.500440]]},"timeSeries":[{"validTime":"2024-03-31T08:00:00Z","parameters":[{"name":"t","levelType":"hl","level":2,"unit":"Cel","values":[8.3]}]}]} \ No newline at end of file +{"approvedTime":"2024-03-31T08:39:25Z","referenceTime":"2024-03-31T08:00:00Z","geometry":{"type":"MultiPoint","coordinates":[[2.250475,52.500440]]},"timeSeries":[{"validTime":"2024-03-31T08:00:00Z","parameters":[{"name":"t","levelType":"hl","level":2,"unit":"Cel","values":[8.3]}]}]} diff --git a/tests/fixtures/mesan/point.txt b/tests/fixtures/mesan/point.txt index 50d7aaf7..db78ec46 100644 --- a/tests/fixtures/mesan/point.txt +++ b/tests/fixtures/mesan/point.txt @@ -16,4 +16,4 @@ Accept-Ranges: bytes Connection: keep-alive Transfer-Encoding: chunked -{"approvedTime":"2024-03-31T08:39:25Z","referenceTime":"2024-03-31T08:00:00Z","geometry":{"type":"Point","coordinates":[[16.150350,58.570784]]},"timeSeries":[{"validTime":"2024-03-31T08:00:00Z","parameters":[{"name":"t","levelType":"hl","level":2,"unit":"Cel","values":[5.5]},{"name":"gust","levelType":"hl","level":10,"unit":"m/s","values":[5.7]},{"name":"r","levelType":"hl","level":2,"unit":"percent","values":[90]},{"name":"msl","levelType":"hmsl","level":0,"unit":"hPa","values":[1002.5]},{"name":"Tiw","levelType":"hl","level":2,"unit":"Cel","values":[4.8]},{"name":"cb_sig","levelType":"hmsl","level":0,"unit":"m","values":[178]},{"name":"cb_sig","levelType":"hl","level":0,"unit":"m","values":[143]},{"name":"c_sigfr","levelType":"hl","level":0,"unit":"percent","values":[80]},{"name":"tcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"ct_sig","levelType":"hl","level":0,"unit":"m","values":[9792]},{"name":"lcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"hcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"mcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"prtype","levelType":"hl","level":0,"unit":"code","values":[-9]},{"name":"pmax","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmin","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmedian","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmean","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"prec1h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"prec3h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"frsn1h","levelType":"hl","level":0,"unit":"cm","values":[0.0]},{"name":"vis","levelType":"hl","level":2,"unit":"km","values":[43.9]},{"name":"spp","levelType":"hl","level":0,"unit":"percent","values":[-9]},{"name":"prsort","levelType":"hl","level":0,"unit":"code","values":[0]},{"name":"wd","levelType":"hl","level":10,"unit":"degree","values":[86]},{"name":"ws","levelType":"hl","level":10,"unit":"m/s","values":[2.9]},{"name":"Wsymb2","levelType":"hl","level":0,"unit":"category","values":[6]}]},{"validTime":"2024-03-31T07:00:00Z","parameters":[{"name":"t","levelType":"hl","level":2,"unit":"Cel","values":[4.7]},{"name":"gust","levelType":"hl","level":10,"unit":"m/s","values":[5.1]},{"name":"r","levelType":"hl","level":2,"unit":"percent","values":[93]},{"name":"msl","levelType":"hmsl","level":0,"unit":"hPa","values":[1002.6]},{"name":"Tiw","levelType":"hl","level":2,"unit":"Cel","values":[4.2]},{"name":"cb_sig","levelType":"hmsl","level":0,"unit":"m","values":[178]},{"name":"cb_sig","levelType":"hl","level":0,"unit":"m","values":[139]},{"name":"c_sigfr","levelType":"hl","level":0,"unit":"percent","values":[80]},{"name":"tcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"ct_sig","levelType":"hl","level":0,"unit":"m","values":[6728]},{"name":"lcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"hcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"mcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"prtype","levelType":"hl","level":0,"unit":"code","values":[-9]},{"name":"pmax","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmin","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmedian","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmean","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"prec1h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"prec3h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"frsn1h","levelType":"hl","level":0,"unit":"cm","values":[0.0]},{"name":"vis","levelType":"hl","level":2,"unit":"km","values":[38.0]},{"name":"spp","levelType":"hl","level":0,"unit":"percent","values":[-9]},{"name":"prsort","levelType":"hl","level":0,"unit":"code","values":[0]},{"name":"wd","levelType":"hl","level":10,"unit":"degree","values":[83]},{"name":"ws","levelType":"hl","level":10,"unit":"m/s","values":[2.4]},{"name":"Wsymb2","levelType":"hl","level":0,"unit":"category","values":[6]}]}]} \ No newline at end of file +{"approvedTime":"2024-03-31T08:39:25Z","referenceTime":"2024-03-31T08:00:00Z","geometry":{"type":"Point","coordinates":[[16.150350,58.570784]]},"timeSeries":[{"validTime":"2024-03-31T08:00:00Z","parameters":[{"name":"t","levelType":"hl","level":2,"unit":"Cel","values":[5.5]},{"name":"gust","levelType":"hl","level":10,"unit":"m/s","values":[5.7]},{"name":"r","levelType":"hl","level":2,"unit":"percent","values":[90]},{"name":"msl","levelType":"hmsl","level":0,"unit":"hPa","values":[1002.5]},{"name":"Tiw","levelType":"hl","level":2,"unit":"Cel","values":[4.8]},{"name":"cb_sig","levelType":"hmsl","level":0,"unit":"m","values":[178]},{"name":"cb_sig","levelType":"hl","level":0,"unit":"m","values":[143]},{"name":"c_sigfr","levelType":"hl","level":0,"unit":"percent","values":[80]},{"name":"tcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"ct_sig","levelType":"hl","level":0,"unit":"m","values":[9792]},{"name":"lcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"hcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"mcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"prtype","levelType":"hl","level":0,"unit":"code","values":[-9]},{"name":"pmax","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmin","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmedian","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmean","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"prec1h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"prec3h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"frsn1h","levelType":"hl","level":0,"unit":"cm","values":[0.0]},{"name":"vis","levelType":"hl","level":2,"unit":"km","values":[43.9]},{"name":"spp","levelType":"hl","level":0,"unit":"percent","values":[-9]},{"name":"prsort","levelType":"hl","level":0,"unit":"code","values":[0]},{"name":"wd","levelType":"hl","level":10,"unit":"degree","values":[86]},{"name":"ws","levelType":"hl","level":10,"unit":"m/s","values":[2.9]},{"name":"Wsymb2","levelType":"hl","level":0,"unit":"category","values":[6]}]},{"validTime":"2024-03-31T07:00:00Z","parameters":[{"name":"t","levelType":"hl","level":2,"unit":"Cel","values":[4.7]},{"name":"gust","levelType":"hl","level":10,"unit":"m/s","values":[5.1]},{"name":"r","levelType":"hl","level":2,"unit":"percent","values":[93]},{"name":"msl","levelType":"hmsl","level":0,"unit":"hPa","values":[1002.6]},{"name":"Tiw","levelType":"hl","level":2,"unit":"Cel","values":[4.2]},{"name":"cb_sig","levelType":"hmsl","level":0,"unit":"m","values":[178]},{"name":"cb_sig","levelType":"hl","level":0,"unit":"m","values":[139]},{"name":"c_sigfr","levelType":"hl","level":0,"unit":"percent","values":[80]},{"name":"tcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"ct_sig","levelType":"hl","level":0,"unit":"m","values":[6728]},{"name":"lcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"hcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"mcc","levelType":"hl","level":0,"unit":"octas","values":[8]},{"name":"prtype","levelType":"hl","level":0,"unit":"code","values":[-9]},{"name":"pmax","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmin","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmedian","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"pmean","levelType":"hl","level":0,"unit":"kg/m2/h","values":[0.0]},{"name":"prec1h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"prec3h","levelType":"hl","level":0,"unit":"mm","values":[0.0]},{"name":"frsn1h","levelType":"hl","level":0,"unit":"cm","values":[0.0]},{"name":"vis","levelType":"hl","level":2,"unit":"km","values":[38.0]},{"name":"spp","levelType":"hl","level":0,"unit":"percent","values":[-9]},{"name":"prsort","levelType":"hl","level":0,"unit":"code","values":[0]},{"name":"wd","levelType":"hl","level":10,"unit":"degree","values":[83]},{"name":"ws","levelType":"hl","level":10,"unit":"m/s","values":[2.4]},{"name":"Wsymb2","levelType":"hl","level":0,"unit":"category","values":[6]}]}]} diff --git a/tests/integration/test_integration_smhi.py b/tests/integration/_test_integration_smhi.py similarity index 100% rename from tests/integration/test_integration_smhi.py rename to tests/integration/_test_integration_smhi.py diff --git a/tests/unit/test_unit_strang.py b/tests/unit/test_unit_strang.py index 87d385b2..7a52a36c 100644 --- a/tests/unit/test_unit_strang.py +++ b/tests/unit/test_unit_strang.py @@ -403,7 +403,7 @@ def test_unit_strang_build_time_multipoint_url(self, time_interval, expected_url [ (200, [{"date_time": "2020-01-01T00:00:00Z"}]), (200, [{"lat": 0, "lon": 0, "value": 0}]), - (400, [{"date_time": "2020-01-01T00:00:00Z"}]), + (200, [{"date_time": "2020-01-01T00:00:00Z"}]), ], ) @patch("smhi.strang.Strang._parse_multipoint_data") @@ -430,17 +430,7 @@ def test_unit_strang_get_and_load_data( status_expected, data, ): - """Unit test for Strang Point get_and_load_strang_data method. - - Args: - mock_requests_get: mock requests get method - mock_json_loads: mock json loads method - mock_logging: mock of logging warning method - mock_parse_point_data: mock of _parse_point_data - mock_parse_multipoint_data: mock of _parse_multipoint_data - status: request status - data: date - """ + """Unit test for Strang Point get_and_load_strang_data method.""" client = Strang() client.url = "URL" mock_json_loads.return_value = data @@ -519,9 +509,7 @@ def test_unit_strang_parse_point_data( output: output data """ client = Strang() - parameter_model = STRANG_PARAMETERS[parameter] - - data = client._parse_point_data(input, parameter_model) + data = client._parse_point_data(input) pd.testing.assert_frame_equal(data, output) @@ -550,8 +538,6 @@ def test_unit_strang_parse_multipoint_data( output: output data """ client = Strang() - parameter_model = STRANG_PARAMETERS[parameter] - - data = client._parse_multipoint_data(input, parameter_model) + data = client._parse_multipoint_data(input) pd.testing.assert_frame_equal(data, output)