Back to index

python-biopython  1.60
Classes | Functions | Variables
test_GraphicsBitmaps Namespace Reference

Classes

class  ComparativeTest

Functions

def real_test

Variables

tuple runner = unittest.TextTestRunner(verbosity = 2)

Function Documentation

Definition at line 54 of file test_GraphicsBitmaps.py.

00054 
00055 def real_test():
00056     min_two_d_lists = 1
00057     max_two_d_lists = 7
00058 
00059     min_num_points = 1
00060     max_num_points = 500
00061 
00062     min_point_num = 0
00063     max_point_num = 200
00064 
00065     plot_info = []
00066     num_two_d_lists = random.randrange(min_two_d_lists, max_two_d_lists)
00067 
00068     for two_d_list in range(num_two_d_lists):
00069         cur_list = []
00070         num_points = random.randrange(min_num_points, max_num_points)
00071         for point in range(num_points):
00072             x_point = random.randrange(min_point_num, max_point_num)
00073             y_point = random.randrange(min_point_num, max_point_num)
00074             cur_list.append((x_point, y_point))
00075         plot_info.append(cur_list)
00076     
00077     compare_plot = ComparativeScatterPlot("png")
00078     compare_plot.display_info = plot_info
00079 
00080     output_file = os.path.join(os.getcwd(), "Graphics", "scatter_test.png")
00081     try:
00082         compare_plot.draw_to_file(output_file, "Testing Scatter Plots")
00083     # there is a bug in reportlab which occasionally generates an
00084     # error here.
00085     except IndexError:
00086         pass
00087     except IOError, err:
00088         if "encoder zip not available" in str(err):
00089             raise MissingExternalDependencyError(
00090                 "Check zip encoder installed for PIL and ReportLab renderPM")
00091         else:
00092             raise err
00093     except RenderPMError, err :
00094         if str(err).startswith("Can't setFont(") :
00095             #TODO - can we raise the error BEFORE the unit test function
00096             #is run? That way it can be skipped in run_tests.py
00097             raise MissingExternalDependencyError(\
00098                 "Check the fonts needed by ReportLab if you want "
00099                 "bitmaps from Bio.Graphics\n" + str(err))
00100         else :
00101             raise err
00102     
00103     return True
00104 
00105 #Run the actual test BEFORE the unittest stuff gets called
00106 real_test()
               

Variable Documentation

tuple test_GraphicsBitmaps.runner = unittest.TextTestRunner(verbosity = 2)

Definition at line 115 of file test_GraphicsBitmaps.py.