ó
"ˆIc           @   sÁ   d  Z  d d l Z d d l Z d d l Z d d l m Z y d d l Z [ Wn e d ƒ ‚ n Xd d l m	 Z	 d e j
 f d „  ƒ  YZ e d k r½ e j d	 d
 ƒ Z e j d e ƒ n  d S(   s1  Test for graphics things that don't really deserve there own test module.

XXX Right now this test occasionally fails with a trace like:

File "/usr/local/lib/python2.1/site-packages/reportlab/graphics/
charts/lineplots.py", line 182, in calcPositions
    datum = self.data[rowNo][colNo] # x,y value
IndexError: list index out of range

This appears to be a problem with reportlab, so I'm not worrying about
it right now, unless it starts to happen with real data! If anyone
can figure out the data that causes it so I can avoid it, that'd be much
appreciated.
iÿÿÿÿN(   t   MissingExternalDependencyErrors2   Install reportlab if you want to use Bio.Graphics.(   t   ComparativeScatterPlott   ComparativeTestc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s7   Do tests for modules involved with comparing data.
    c         C   s:   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d  S(   Ni   i   iô  i    iÈ   (   t   min_two_d_listst   max_two_d_listst   min_num_pointst   max_num_pointst   min_point_numt   max_point_num(   t   self(    (    s   test_GraphicsGeneral.pyt   setUp%   s    					c   	      C   s¾   g  } t  j |  j |  j ƒ } x™ t | ƒ D]‹ } g  } t  j |  j |  j ƒ } xW t | ƒ D]I } t  j |  j |  j ƒ } t  j |  j |  j ƒ } | j	 | | f ƒ q\ W| j	 | ƒ q+ W| S(   s9   Make a bunch of random points for testing plots.
        (
   t   randomt	   randrangeR   R   t   rangeR   R   R   R   t   append(	   R	   t	   plot_infot   num_two_d_listst
   two_d_listt   cur_listt
   num_pointst   pointt   x_pointt   y_point(    (    s   test_GraphicsGeneral.pyt   _make_random_points/   s    c         C   sb   t  ƒ  } |  j ƒ  | _ t j j t j ƒ  d d ƒ } y | j | d ƒ Wn t k
 r] n Xd S(   s/   Test creation of a simple ScatterPlot.
        t   Graphicss   scatter_test.pdfs   Testing Scatter PlotsN(	   R   R   t   display_infot   ost   patht   joint   getcwdt   draw_to_filet
   IndexError(   R	   t   compare_plott   output_file(    (    s   test_GraphicsGeneral.pyt   test_simple_scatter_plotE   s    	(   t   __name__t
   __module__t   __doc__R
   R   R"   (    (    (    s   test_GraphicsGeneral.pyR   "   s   	
	t   __main__t	   verbosityi   t
   testRunner(   R%   R   R   t   unittestt   BioR    t	   reportlabt   rt   Bio.Graphics.ComparativeR   t   TestCaseR   R#   t   TextTestRunnert   runnert   main(    (    (    s   test_GraphicsGeneral.pyt   <module>   s   1