Esempio n. 1
0
 def test_plot_tree_view_selection_raises_with_mixed_data(self):
     model = _MockParameterModel()
     selected_indexes = list()
     selected_indexes.append(model.index(1, 1))
     selected_indexes.append(model.index(2, 1))
     support = ParameterTablePlottingHints()
     with self.assertRaises(PlottingError):
         plot_selection(model, selected_indexes, support)
 def test_plot_tree_view_selection_into_existing_plot_with_mixed_data_raises(self):
     model = _MockParameterModel()
     selected_indexes = [model.index(2, 1)]
     support = ParameterTablePlottingHints()
     plot_widget = plot_selection(model, selected_indexes, support)
     self.assertEqual(plot_widget.plot_type, TimeSeries)
     selected_indexes = [model.index(0, 1), model.index(1, 1)]
     with self.assertRaises(PlottingError):
         plot_selection(model, selected_indexes, support, plot_widget)
Esempio n. 3
0
 def test_plot_single_plain_number(self):
     """Test that a selection containing a single plain number gets plotted."""
     model = _MockParameterModel()
     selected_indexes = list()
     selected_indexes.append(model.index(0, 1))
     support = ParameterTablePlottingHints()
     plot_widget = plot_selection(model, selected_indexes, support)
     lines = plot_widget.canvas.axes.get_lines()
     self.assertEqual(len(lines), 1)
     self.assertEqual(list(lines[0].get_ydata(orig=True)), [-2.3])
Esempio n. 4
0
 def test_plot_tree_view_selection_of_floats(self):
     model = _MockParameterModel()
     selected_indexes = list()
     selected_indexes.append(model.index(0, 1))
     selected_indexes.append(model.index(1, 1))
     support = ParameterTablePlottingHints()
     plot_widget = plot_selection(model, selected_indexes, support)
     lines = plot_widget.canvas.axes.get_lines()
     self.assertEqual(len(lines), 1)
     self.assertTrue(all(lines[0].get_ydata(orig=True) == [-2.3, -0.5]))
Esempio n. 5
0
 def test_plot_tree_view_selection_of_time_series(self):
     model = _MockParameterModel()
     selected_indexes = list()
     selected_indexes.append(model.index(2, 1))
     selected_indexes.append(model.index(3, 1))
     support = ParameterTablePlottingHints()
     plot_widget = plot_selection(model, selected_indexes, support)
     lines = plot_widget.canvas.axes.get_lines()
     self.assertEqual(len(lines), 2)
     self.assertEqual(list(lines[0].get_ydata(orig=True)), [0.5, 2.3])
     self.assertEqual(list(lines[1].get_ydata(orig=True)), [-5.0, -3.3])
Esempio n. 6
0
 def test_plot_tree_view_selection_into_existing_plot(self):
     model = _MockParameterModel()
     selected_indexes = [model.index(2, 1)]
     support = ParameterTablePlottingHints()
     plot_widget = plot_selection(model, selected_indexes, support)
     self.assertEqual(plot_widget.plot_type, TimeSeries)
     selected_indexes = [model.index(3, 1)]
     plot_selection(model, selected_indexes, support, plot_widget)
     lines = plot_widget.canvas.axes.get_lines()
     self.assertEqual(len(lines), 2)
     self.assertEqual(list(lines[0].get_ydata(orig=True)), [0.5, 2.3])
     self.assertEqual(list(lines[1].get_ydata(orig=True)), [-5.0, -3.3])