Esempio n. 1
0
    def test_target_x_color(self):

        drawer = MPLDrawer(1, 3)

        rgba_red = (1, 0, 0, 1)
        drawer._target_x(0, 0, options={"color": rgba_red})

        center_line = drawer.ax.lines[3]
        assert center_line.get_color() == rgba_red

        horizontal_line = drawer.ax.lines[4]
        assert horizontal_line.get_color() == rgba_red

        circle = drawer.ax.patches[0]
        assert circle.get_facecolor() == to_rgba(
            plt.rcParams["axes.facecolor"])
        assert circle.get_edgecolor() == rgba_red

        plt.close()
Esempio n. 2
0
    def test_target_x(self):
        """Tests hidden target_x drawing method"""

        drawer = MPLDrawer(1, 3)

        drawer._target_x(0, 0)

        center_line = drawer.ax.lines[3]
        assert center_line.get_data() == ((0, 0), (-0.3, 0.3))

        horizontal_line = drawer.ax.lines[4]
        assert horizontal_line.get_data() == ((-0.3, 0.3), (0, 0))

        circle = drawer.ax.patches[0]

        assert circle.center == (0, 0)
        assert circle.width == 0.6
        assert circle.get_facecolor() == to_rgba(
            plt.rcParams["axes.facecolor"])
        assert to_rgba(plt.rcParams["lines.color"]) == to_rgba(
            circle.get_edgecolor())
        plt.close()