Commit 7dbd3e7c authored by Tjerk Vreeken's avatar Tjerk Vreeken

Python 2to3 unittest fixes

The "asserts" option to 2to3.py
parent d4450349
......@@ -19,19 +19,19 @@ class TestPI(TestCase):
def test_parameter_config(self):
parameter_config = pi.ParameterConfig(
data_path(), 'rtcParameterConfig')
self.assertEquals(parameter_config.get("group", "parameter"), 1.0)
self.assertEquals(parameter_config.get(
self.assertEqual(parameter_config.get("group", "parameter"), 1.0)
self.assertEqual(parameter_config.get(
"group", "parameter", location_id="Location2"), 2.0)
parameter_config.set("group", "parameter", 3.0,
location_id="Location2")
self.assertEquals(parameter_config.get("group", "parameter"), 1.0)
self.assertEquals(parameter_config.get(
self.assertEqual(parameter_config.get("group", "parameter"), 1.0)
self.assertEqual(parameter_config.get(
"group", "parameter", location_id="Location2"), 3.0)
parameter_config.write()
parameter_config = pi.ParameterConfig(
data_path(), 'rtcParameterConfig')
self.assertEquals(parameter_config.get("group", "parameter"), 1.0)
self.assertEquals(parameter_config.get(
self.assertEqual(parameter_config.get("group", "parameter"), 1.0)
self.assertEqual(parameter_config.get(
"group", "parameter", location_id="Location2"), 3.0)
parameter_config.set("group", "parameter", 2.0,
location_id="Location2")
......@@ -40,7 +40,7 @@ class TestPI(TestCase):
def test_timeseries(self):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries.get('S')[2], 2.0)
self.assertEqual(timeseries.get('S')[2], 2.0)
self.assertTrue(np.isnan(timeseries.get('S')[3]))
timeseries.write()
......@@ -49,24 +49,24 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries.get('S')[2], 2.0)
self.assertEqual(timeseries.get('S')[2], 2.0)
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=True)
self.assertEquals(timeseries.get('S')[2], 2.0)
self.assertEqual(timeseries.get('S')[2], 2.0)
timeseries.write()
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=True)
self.assertEquals(timeseries.get('S')[2], 2.0)
self.assertEqual(timeseries.get('S')[2], 2.0)
timeseries.set('S', timeseries.get('S'))
def test_ensemble(self):
timeseries = pi.Timeseries(self.data_config, data_path(
), "timeseries_import_ensemble", binary=False)
self.assertEquals(timeseries.get('S', 0)[2], 2.0)
self.assertEquals(timeseries.get('S', 1)[2], 3.0)
self.assertEqual(timeseries.get('S', 0)[2], 2.0)
self.assertEqual(timeseries.get('S', 1)[2], 3.0)
def test_extend_timeseries(self):
# Append item
......@@ -80,8 +80,8 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries.get('S')[-1], 12345.0)
self.assertEquals(len(timeseries.get('S')), len(orig) + 1)
self.assertEqual(timeseries.get('S')[-1], 12345.0)
self.assertEqual(len(timeseries.get('S')), len(orig) + 1)
timeseries.set('S', orig, ensemble_member=0)
timeseries.write()
......@@ -93,7 +93,7 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries._get_unit('S', ensemble_member=0), 'kcfs')
self.assertEqual(timeseries._get_unit('S', ensemble_member=0), 'kcfs')
timeseries._set_unit('S', unit='m3/s', ensemble_member=0)
timeseries.write()
......@@ -107,8 +107,8 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries.get('S')[0], orig[0])
self.assertEquals(len(timeseries.get('S')), len(orig) - 1)
self.assertEqual(timeseries.get('S')[0], orig[0])
self.assertEqual(len(timeseries.get('S')), len(orig) - 1)
timeseries.set('S', orig, ensemble_member=0)
timeseries.write()
......@@ -125,8 +125,8 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries.get('S')[0], 12345.0)
self.assertEquals(len(timeseries.get('S')), len(orig) + 1)
self.assertEqual(timeseries.get('S')[0], 12345.0)
self.assertEqual(len(timeseries.get('S')), len(orig) + 1)
timeseries.set('S', orig, ensemble_member=0)
timeseries.write()
......@@ -140,8 +140,8 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import", binary=False)
self.assertEquals(timeseries.get('S')[0], orig[1])
self.assertEquals(len(timeseries.get('S')), len(orig) - 1)
self.assertEqual(timeseries.get('S')[0], orig[1])
self.assertEqual(len(timeseries.get('S')), len(orig) - 1)
timeseries.set('S', orig, ensemble_member=0)
timeseries.write()
......@@ -159,8 +159,8 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import_neq", binary=False)
self.assertEquals(timeseries.get('S')[-1], 12345.0)
self.assertEquals(len(timeseries.get('S')), len(orig_values) - 1)
self.assertEqual(timeseries.get('S')[-1], 12345.0)
self.assertEqual(len(timeseries.get('S')), len(orig_values) - 1)
timeseries.set('S', orig_values, ensemble_member=0)
# Because we don't support extension of nonequidistant series, we need
# to reset the times manually.
......@@ -181,8 +181,8 @@ class TestPI(TestCase):
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_import_neq", binary=False)
self.assertEquals(timeseries.get('S')[0], 0.0)
self.assertEquals(len(timeseries.get('S')), len(orig_values) - 1)
self.assertEqual(timeseries.get('S')[0], 0.0)
self.assertEqual(len(timeseries.get('S')), len(orig_values) - 1)
timeseries.set('S', orig_values, ensemble_member=0)
# Because we don't support extension of nonequidistant series, we need
# to reset the times manually.
......@@ -194,4 +194,4 @@ class TestPI(TestCase):
for binary in [True, False]:
timeseries = pi.Timeseries(
self.data_config, data_path(), "timeseries_export", binary=binary)
self.assertEquals(len(timeseries.get('S', ensemble_member=0)), 10)
self.assertEqual(len(timeseries.get('S', ensemble_member=0)), 10)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment