Example #1
0
 def test_initial_value(self):
     editor = TimeSeriesVariableResolutionEditor()
     value = editor.value()
     self.assertEqual(
         value,
         TimeSeriesVariableResolution(
             ["2000-01-01T00:00", "2000-01-01T01:00"], [0.0, 0.0], False,
             False))
Example #2
0
 def test_value_access(self):
     editor = TimeSeriesVariableResolutionEditor()
     editor.set_value(
         TimeSeriesVariableResolution(
             ["1996-04-06T16:06", "1996-04-07T16:06", "1996-04-08T16:06"],
             [4.0, 3.5, 3.0], True, True))
     self.assertEqual(
         editor.value(),
         TimeSeriesVariableResolution(
             ["1996-04-06T16:06", "1996-04-07T16:06", "1996-04-08T16:06"],
             [4.0, 3.5, 3.0], True, True),
     )
Example #3
0
 def test_remove_rows_with_time_series_variable_resolution_editor(self):
     editor = TimeSeriesVariableResolutionEditor()
     editor.set_value(
         TimeSeriesVariableResolution(["2020-11-11T14:25", "2020-11-12T14:25"], [-1.1, -2.2], False, False)
     )
     table_view = editor._ui.time_series_table
     table_view.selectRow(0)
     model = table_view.model()
     rect = table_view.visualRect(model.index(0, 0))
     menu = ArrayTableContextMenu(editor, table_view, rect.center())
     remove_action = _find_action(menu, "Remove rows")
     self.assertIsNotNone(remove_action)
     remove_action.trigger()
     self.assertEqual(model.rowCount(), 1 + 1)
     self.assertEqual(model.index(0, 0).data(), "2020-11-12T14:25:00")
     self.assertEqual(model.index(0, 1).data(), -2.2)
Example #4
0
 def test_insert_row_before_with_time_series_variable_resolution_editor(self):
     editor = TimeSeriesVariableResolutionEditor()
     editor.set_value(TimeSeriesVariableResolution(["2020-11-11T14:25"], [-1.1], False, False))
     table_view = editor._ui.time_series_table
     table_view.selectRow(0)
     model = table_view.model()
     rect = table_view.visualRect(model.index(0, 0))
     menu = IndexedValueTableContextMenu(table_view, rect.center())
     insert_action = _find_action(menu, "Insert row before")
     self.assertIsNotNone(insert_action)
     insert_action.trigger()
     self.assertEqual(model.rowCount(), 2 + 1)
     self.assertEqual(model.index(0, 0).data(), "2020-11-11T13:25:00")
     self.assertEqual(model.index(0, 1).data(), 0.0)
     self.assertEqual(model.index(1, 0).data(), "2020-11-11T14:25:00")
     self.assertEqual(model.index(1, 1).data(), -1.1)