def testColor(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(len(ax.lines), 2) self.assertTrue(ax.lines[0].get_color() in ['black', 'k']) self.assertTrue(ax.lines[1].get_color() in ['black', 'k'])
def testXValues(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(len(ax.lines), 2) x = ax.lines[0]._x np.testing.assert_array_almost_equal(x, self.expected_x)
def testYValues(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(len(ax.lines), 2) y1 = ax.lines[0]._y np.testing.assert_array_almost_equal(y1, self.expected_y1) y2 = ax.lines[1]._y np.testing.assert_array_almost_equal(y2, self.expected_y2)
def testLegendLocation(self): ax = self.fig.gca() createPlot(ax) self.assertIsNotNone(ax.get_legend()) self.assertEqual(ax.get_legend()._get_loc(), 2)
def testGrid(self): ax = MagicMock() createPlot(ax) ax.grid.assert_called()
def testYLim(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(ax.get_ylim(), (-1.5, 2.0))
def testTitle(self): ax = self.fig.gca() createPlot(ax) self.assertEqual("Zwei versetzte Sinussignale", ax.title._text)
def testAxisLabels(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(ax.get_ylabel(), "Amplitude in mV") self.assertEqual(ax.get_xlabel(), "Zeit in us")
def testLinestyle(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(len(ax.lines), 2) self.assertEqual(ax.lines[0].get_linestyle(), '-') self.assertEqual(ax.lines[1].get_linestyle(), '--')
def testLabels(self): ax = self.fig.gca() createPlot(ax) self.assertEqual(len(ax.lines), 2) self.assertEqual(ax.lines[0].get_label(), '2.63 MHz mit 0° Phasenverschiebung') self.assertEqual(ax.lines[1].get_label(), '2.63 MHz mit 35° Phasenverschiebung')