From 8852f1cd41c062ba6ede494b73399ca820bf8327 Mon Sep 17 00:00:00 2001 From: Martin Lange <martin.lange@ufz.de> Date: Mon, 28 Nov 2022 18:44:05 +0100 Subject: [PATCH] fix all the trivial to fix tests --- tests/adapters/test_base.py | 10 +++++----- tests/adapters/test_regrid.py | 22 +++++++++++----------- tests/adapters/test_stats.py | 2 +- tests/adapters/test_time_integration.py | 4 ++-- tests/core/test_sdk.py | 2 +- tests/data/test_tools.py | 2 +- tests/modules/test_control.py | 2 +- tests/modules/test_csv_reader.py | 8 ++++---- tests/modules/test_noise.py | 18 +++++++++--------- tests/modules/test_parametric.py | 16 ++++++++-------- tests/tools/test_connect.py | 4 ++-- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/adapters/test_base.py b/tests/adapters/test_base.py index 8438d973..fbfa0537 100644 --- a/tests/adapters/test_base.py +++ b/tests/adapters/test_base.py @@ -88,7 +88,7 @@ class TestGridToValue(unittest.TestCase): self.adapter = GridToValue(func=np.ma.mean) self.source.outputs["Grid"] >> self.adapter - self.adapter.get_info(Info(None, grid=NoGrid())) + self.adapter.get_info(Info(None, grid=NoGrid(), units=None)) self.source.connect(datetime(2000, 1, 1)) self.source.connect(datetime(2000, 1, 1)) self.source.validate() @@ -100,7 +100,7 @@ class TestGridToValue(unittest.TestCase): self.adapter = GridToValue(func=np.ma.sum) self.source.outputs["Grid"] >> self.adapter - self.adapter.get_info(Info(None, grid=NoGrid())) + self.adapter.get_info(Info(None, grid=NoGrid(), units=None)) self.source.connect(datetime(2000, 1, 1)) self.source.connect(datetime(2000, 1, 1)) self.source.validate() @@ -131,7 +131,7 @@ class TestValueToGrid(unittest.TestCase): self.adapter = ValueToGrid(grid) self.source.outputs["Value"] >> self.adapter - self.adapter.get_info(Info(None, grid=grid)) + self.adapter.get_info(Info(None, grid=grid, units=None)) self.source.connect(datetime(2000, 1, 1)) self.source.connect(datetime(2000, 1, 1)) self.source.validate() @@ -149,7 +149,7 @@ class TestValueToGrid(unittest.TestCase): self.source.outputs["Value"] >> self.adapter with self.assertRaises(fm.FinamMetaDataError): - self.adapter.get_info(Info(None, grid=UniformGrid((2, 2)))) + self.adapter.get_info(Info(None, grid=UniformGrid((2, 2)), units=None)) def test_value_to_grid_from_target(self): grid, data = create_grid(10, 10, 1.0) @@ -157,7 +157,7 @@ class TestValueToGrid(unittest.TestCase): self.adapter = ValueToGrid(None) self.source.outputs["Value"] >> self.adapter - self.adapter.get_info(Info(None, grid=grid)) + self.adapter.get_info(Info(None, grid=grid, units=None)) self.source.connect(datetime(2000, 1, 1)) self.source.connect(datetime(2000, 1, 1)) self.source.validate() diff --git a/tests/adapters/test_regrid.py b/tests/adapters/test_regrid.py index 50c914c1..49f0b542 100644 --- a/tests/adapters/test_regrid.py +++ b/tests/adapters/test_regrid.py @@ -51,7 +51,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec)}, + {"Input": Info(None, grid=out_spec, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -104,7 +104,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec)}, + {"Input": Info(None, grid=out_spec, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -148,7 +148,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec)}, + {"Input": Info(None, grid=out_spec, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -192,7 +192,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec)}, + {"Input": Info(None, grid=out_spec, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -237,7 +237,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=None)}, + {"Input": Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -281,7 +281,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec)}, + {"Input": Info(None, grid=out_spec, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -321,12 +321,12 @@ class TestRegrid(unittest.TestCase): ) sink_1 = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec_1)}, + {"Input": Info(None, grid=out_spec_1, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) sink_2 = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec_2)}, + {"Input": Info(None, grid=out_spec_2, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -376,12 +376,12 @@ class TestRegrid(unittest.TestCase): ) sink_1 = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec_1)}, + {"Input": Info(None, grid=out_spec_1, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) sink_2 = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec_2)}, + {"Input": Info(None, grid=out_spec_2, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -434,7 +434,7 @@ class TestRegrid(unittest.TestCase): ) sink = debug.DebugConsumer( - {"Input": Info(None, grid=out_spec)}, + {"Input": Info(None, grid=out_spec, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) diff --git a/tests/adapters/test_stats.py b/tests/adapters/test_stats.py index e5acdf18..c90d44ba 100644 --- a/tests/adapters/test_stats.py +++ b/tests/adapters/test_stats.py @@ -18,7 +18,7 @@ class TestHistogram(unittest.TestCase): source = fm.modules.SimplexNoise(info=in_info) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=time, step=timedelta(days=1), ) diff --git a/tests/adapters/test_time_integration.py b/tests/adapters/test_time_integration.py index 0fb92258..088860c5 100644 --- a/tests/adapters/test_time_integration.py +++ b/tests/adapters/test_time_integration.py @@ -33,7 +33,7 @@ class TestAvgOverTime(unittest.TestCase): self.source.initialize() self.source.outputs["Step"] >> self.adapter - self.adapter.get_info(Info(None, grid=NoGrid())) + self.adapter.get_info(Info(None, grid=NoGrid(), units=None)) self.source.connect(start) self.source.connect(start) @@ -110,7 +110,7 @@ class TestGridAvgOverTime(unittest.TestCase): self.source.initialize() self.source.outputs["Grid"] >> self.adapter - self.adapter.get_info(Info(None, grid=grid)) + self.adapter.get_info(Info(None, grid=grid, units=None)) self.source.connect(start) self.source.connect(start) diff --git a/tests/core/test_sdk.py b/tests/core/test_sdk.py index 1ca2e537..1f9c9a83 100644 --- a/tests/core/test_sdk.py +++ b/tests/core/test_sdk.py @@ -687,7 +687,7 @@ class TestIOFails(unittest.TestCase): out.get_info(Info(time=t, grid=None)) with self.assertRaises(FinamMetaDataError): - out.get_info(Info(time=t, grid=NoGrid())) + out.get_info(Info(time=t, grid=NoGrid(), units=None)) with self.assertRaises(FinamMetaDataError): out.get_info(Info(time=t, grid=NoGrid(), units=None)) diff --git a/tests/data/test_tools.py b/tests/data/test_tools.py index 6479f831..b93c18f0 100644 --- a/tests/data/test_tools.py +++ b/tests/data/test_tools.py @@ -240,7 +240,7 @@ class TestDataTools(unittest.TestCase): finam.data.to_xarray( 1.0 * finam.UNITS.meter, "A", - finam.Info(time, grid=finam.NoGrid(), units="km"), + finam.Info(time, grid=finam.NoGrid(), units="m^3"), ) def test_assert_type(self): diff --git a/tests/modules/test_control.py b/tests/modules/test_control.py index 06b7ece2..b84ebf01 100644 --- a/tests/modules/test_control.py +++ b/tests/modules/test_control.py @@ -20,7 +20,7 @@ class TestTimeTrigger(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) diff --git a/tests/modules/test_csv_reader.py b/tests/modules/test_csv_reader.py index 2ea1c800..efec51be 100644 --- a/tests/modules/test_csv_reader.py +++ b/tests/modules/test_csv_reader.py @@ -51,11 +51,11 @@ class TestCsvReader(unittest.TestCase): reader.connect(start) reader.connect(start) - sink1.exchange_info(Info(None, grid=NoGrid())) - sink2.exchange_info(Info(None, grid=NoGrid())) + sink1.exchange_info(Info(None, grid=NoGrid(), units=None)) + sink2.exchange_info(Info(None, grid=NoGrid(), units=None)) - reader.outputs["X"].get_info(Info(None, grid=NoGrid())) - reader.outputs["Y"].get_info(Info(None, grid=NoGrid())) + reader.outputs["X"].get_info(Info(None, grid=NoGrid(), units=None)) + reader.outputs["Y"].get_info(Info(None, grid=NoGrid(), units=None)) reader.connect(start) reader.connect(start) diff --git a/tests/modules/test_noise.py b/tests/modules/test_noise.py index 8c7d2066..2932c2b0 100644 --- a/tests/modules/test_noise.py +++ b/tests/modules/test_noise.py @@ -22,7 +22,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -54,7 +54,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -86,7 +86,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -118,7 +118,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -150,7 +150,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -182,7 +182,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -214,7 +214,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -246,7 +246,7 @@ class TestNoise(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -287,7 +287,7 @@ class TestStaticNoise(unittest.TestCase): # We want to get to a point where this works sink = fm.modules.DebugPushConsumer( inputs={ - "Input": fm.Info(time=None, grid=fm.NoGrid()), + "Input": fm.Info(time=None, grid=fm.NoGrid(), units="m"), }, log_data="INFO", ) diff --git a/tests/modules/test_parametric.py b/tests/modules/test_parametric.py index bc50ab89..858cecde 100644 --- a/tests/modules/test_parametric.py +++ b/tests/modules/test_parametric.py @@ -26,7 +26,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -62,7 +62,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -100,7 +100,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -135,7 +135,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -171,7 +171,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -207,7 +207,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -243,7 +243,7 @@ class TestParametricGrid(unittest.TestCase): step=timedelta(days=1), ) sink = fm.modules.DebugConsumer( - {"Input": fm.Info(None, grid=None)}, + {"Input": fm.Info(None, grid=None, units=None)}, start=datetime(2000, 1, 1), step=timedelta(days=1), ) @@ -272,7 +272,7 @@ class TestStaticParametricGrid(unittest.TestCase): ) sink = fm.modules.DebugPushConsumer( inputs={ - "Input": fm.Info(time=None, grid=in_info.grid), + "Input": fm.Info(time=None, grid=in_info.grid, units=None), }, log_data="INFO", ) diff --git a/tests/tools/test_connect.py b/tests/tools/test_connect.py index e84e5adc..56a7a7ee 100644 --- a/tests/tools/test_connect.py +++ b/tests/tools/test_connect.py @@ -320,7 +320,7 @@ class TestConnectHelper(unittest.TestCase): sink.exchange_info(Info(time=time, grid=UniformGrid((10, 10)), units="m")) connector.connect(start_time=time) - sources[0].push_info(Info(time=time, grid=UniformGrid((10, 10)))) + sources[0].push_info(Info(time=time, grid=UniformGrid((10, 10)), units="m")) sources[1].push_info(Info(time=time, grid=NoGrid(), units="m")) connector.connect(start_time=time) @@ -328,7 +328,7 @@ class TestConnectHelper(unittest.TestCase): self.assertEqual( connector.in_infos, { - "In1": Info(time=time, grid=UniformGrid((10, 10))), + "In1": Info(time=time, grid=UniformGrid((10, 10)), units="m"), "In2": Info(time=time, grid=NoGrid(), units="m"), }, ) -- GitLab