Exemplo n.º 1
0
 def test_simple_scatter_plot_7(self):
     """Test creation of a simple ScatterPlot with more lists."""
     compare_plot = ComparativeScatterPlot()
     # There are 6 pre-defined colors and symbols, doing more:
     compare_plot.display_info = self._make_random_points(7)
     output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test_7.pdf")
     compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
Exemplo n.º 2
0
 def test_simple_scatter_plot_1(self):
     """Test creation of a simple ScatterPlot with one list."""
     compare_plot = ComparativeScatterPlot()
     compare_plot.display_info = self._make_random_points(1)
     output_file = os.path.join(os.getcwd(), "Graphics",
                                "scatter_test_1.pdf")
     compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
Exemplo n.º 3
0
 def test_simple_scatter_plot_7(self):
     """Test creation of a simple ScatterPlot with more lists."""
     compare_plot = ComparativeScatterPlot()
     # There are 6 pre-defined colors and symbols, doing more:
     compare_plot.display_info = self._make_random_points(7)
     output_file = os.path.join(os.getcwd(), "Graphics",
                                "scatter_test_7.pdf")
     compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
Exemplo n.º 4
0
    def test_simple_scatter_plot(self):
        """Test creation of a simple PNG scatter plot."""
        compare_plot = ComparativeScatterPlot("png")
        compare_plot.display_info = self._make_random_points()

        output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
        try:
            compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
        # there is a bug in reportlab which occasionally generates an
        # error here.
        except IndexError:
            pass
Exemplo n.º 5
0
def real_test():
    min_two_d_lists = 1
    max_two_d_lists = 7

    min_num_points = 1
    max_num_points = 500

    min_point_num = 0
    max_point_num = 200

    plot_info = []
    num_two_d_lists = random.randrange(min_two_d_lists, max_two_d_lists)

    for two_d_list in range(num_two_d_lists):
        cur_list = []
        num_points = random.randrange(min_num_points, max_num_points)
        for point in range(num_points):
            x_point = random.randrange(min_point_num, max_point_num)
            y_point = random.randrange(min_point_num, max_point_num)
            cur_list.append((x_point, y_point))
        plot_info.append(cur_list)

    compare_plot = ComparativeScatterPlot("png")
    compare_plot.display_info = plot_info

    output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
    try:
        compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
    # there is a bug in reportlab which occasionally generates an
    # error here.
    except IndexError:
        pass
    except OSError as err:
        if "encoder zip not available" in str(err):
            raise MissingExternalDependencyError(
                "Check zip encoder installed for PIL and ReportLab renderPM"
            ) from None
        else:
            raise
    except RenderPMError as err:
        if str(err).startswith("Can't setFont(") or str(err).startswith(
                "Error in setFont("):
            # TODO - can we raise the error BEFORE the unit test function
            # is run? That way it can be skipped in run_tests.py
            raise MissingExternalDependencyError(
                "Check the fonts needed by ReportLab if you want "
                "bitmaps from Bio.Graphics\n" + str(err)) from None
        else:
            raise

    return True
Exemplo n.º 6
0
def real_test():
    min_two_d_lists = 1
    max_two_d_lists = 7

    min_num_points = 1
    max_num_points = 500

    min_point_num = 0
    max_point_num = 200

    plot_info = []
    num_two_d_lists = random.randrange(min_two_d_lists, max_two_d_lists)

    for two_d_list in range(num_two_d_lists):
        cur_list = []
        num_points = random.randrange(min_num_points, max_num_points)
        for point in range(num_points):
            x_point = random.randrange(min_point_num, max_point_num)
            y_point = random.randrange(min_point_num, max_point_num)
            cur_list.append((x_point, y_point))
        plot_info.append(cur_list)

    compare_plot = ComparativeScatterPlot("png")
    compare_plot.display_info = plot_info

    output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
    try:
        compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
    # there is a bug in reportlab which occasionally generates an
    # error here.
    except IndexError:
        pass
    except IOError as err:
        if "encoder zip not available" in str(err):
            raise MissingExternalDependencyError(
                "Check zip encoder installed for PIL and ReportLab renderPM")
        else:
            raise err
    except RenderPMError as err:
        if str(err).startswith("Can't setFont("):
            # TODO - can we raise the error BEFORE the unit test function
            # is run? That way it can be skipped in run_tests.py
            raise MissingExternalDependencyError(
                "Check the fonts needed by ReportLab if you want "
                "bitmaps from Bio.Graphics\n" + str(err))
        else:
            raise err

    return True
Exemplo n.º 7
0
    def test_simple_scatter_plot(self):
        """Test creation of a simple PNG scatter plot."""
        compare_plot = ComparativeScatterPlot("png")
        compare_plot.display_info = self._make_random_points()

        output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
        try:
            compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
        # there is a bug in reportlab which occasionally generates an
        # error here.
        except IndexError:
            pass
        except RenderPMError, err :
            if str(err).startswith("Can't setFont(") :
                #TODO - can we raise the error BEFORE the unit test function
                #is run? That way it can be skipped in run_tests.py
                raise MissingExternalDependencyError(\
                    "Check the fonts needed by ReportLab if you want "
                    "bitmaps from Bio.Graphics\n" + str(err))
            else :
                raise err
Exemplo n.º 8
0
def real_test():
    min_two_d_lists = 1
    max_two_d_lists = 7

    min_num_points = 1
    max_num_points = 500

    min_point_num = 0
    max_point_num = 200

    plot_info = []
    num_two_d_lists = random.randrange(min_two_d_lists, max_two_d_lists)

    for two_d_list in range(num_two_d_lists):
        cur_list = []
        num_points = random.randrange(min_num_points, max_num_points)
        for point in range(num_points):
            x_point = random.randrange(min_point_num, max_point_num)
            y_point = random.randrange(min_point_num, max_point_num)
            cur_list.append((x_point, y_point))
        plot_info.append(cur_list)

    compare_plot = ComparativeScatterPlot("png")
    compare_plot.display_info = plot_info

    output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
    try:
        compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
    # there is a bug in reportlab which occasionally generates an
    # error here.
    except IndexError:
        pass
    except IOError, err:
        if "encoder zip not available" in str(err):
            raise MissingExternalDependencyError(
                "Check zip encoder installed for PIL and ReportLab renderPM")
        else:
            raise err
def real_test():
    min_two_d_lists = 1
    max_two_d_lists = 7

    min_num_points = 1
    max_num_points = 500

    min_point_num = 0
    max_point_num = 200

    plot_info = []
    num_two_d_lists = random.randrange(min_two_d_lists, max_two_d_lists)

    for two_d_list in range(num_two_d_lists):
        cur_list = []
        num_points = random.randrange(min_num_points, max_num_points)
        for point in range(num_points):
            x_point = random.randrange(min_point_num, max_point_num)
            y_point = random.randrange(min_point_num, max_point_num)
            cur_list.append((x_point, y_point))
        plot_info.append(cur_list)
    
    compare_plot = ComparativeScatterPlot("png")
    compare_plot.display_info = plot_info

    output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
    try:
        compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
    # there is a bug in reportlab which occasionally generates an
    # error here.
    except IndexError:
        pass
    except IOError, err:
        if "encoder zip not available" in str(err):
            raise MissingExternalDependencyError(
                "Check zip encoder installed for PIL and ReportLab renderPM")
        else:
            raise err
Exemplo n.º 10
0
 def test_simple_scatter_plot_1(self):
     """Test creation of a simple ScatterPlot with one list."""
     compare_plot = ComparativeScatterPlot()
     compare_plot.display_info = self._make_random_points(1)
     output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test_1.pdf")
     compare_plot.draw_to_file(output_file, "Testing Scatter Plots")