ó
šIc           @   s€   d  Z  d d l Z d d l m Z d 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(   s   Unit test for DesiÿÿÿÿN(   t   Des(   t   Residuest   DesTestsc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   d |  _  d  S(   Ns   ./SCOP/dir.des.scop.txt_test(   t   filename(   t   self(    (    s   test_SCOP_Des.pyt   setUp   s    c         C   sm   t  |  j ƒ } zL d } t j | ƒ } x | D] } | d 7} q. W| d k sZ t d ƒ ‚ Wd  | j ƒ  Xd  S(   Ni    i   i   s   Wrong number of records?!(   t   openR   R    t   parset   AssertionErrort   close(   R   t   ft   countt   recordst   record(    (    s   test_SCOP_Des.pyt	   testParse   s    c         C   si   t  |  j ƒ } zH xA | D]9 } t j | ƒ } t | ƒ j ƒ  | j ƒ  k s t ‚ q WWd  | j ƒ  Xd  S(   N(   R   R   R    t   Recordt   strt   rstripR   R	   (   R   R
   t   lineR   (    (    s   test_SCOP_Des.pyt   testStr    s    ,c         C   sE   d } y% t  j | ƒ } t s* t d ƒ ‚ Wn t k
 r@ } n Xd  S(   Ns   49268	sp	b.1.2.1	-
s   Should never get here(   R    R   t   FalseR   t
   ValueError(   R   t
   corruptRecR   t   e(    (    s   test_SCOP_Des.pyt	   testError*   s    c         C   sœ   d } d } t  j | ƒ } | j | d k s4 t ‚ | j | d k sM t ‚ | j | d	 k sf t ‚ | j | d
 k s t ‚ | j | d k s˜ t ‚ d  S(   Ns,   49268	sp	b.1.2.1	-	Human (Homo sapiens)    
itÀ  t   sps   b.1.2.1t    s   Human (Homo sapiens)i    i   i   i   i   (   itÀ  R   s   b.1.2.1R   s   Human (Homo sapiens)(   R    R   t   sunidR   t   nodetypet   sccst   namet   description(   R   t   recLinet	   recFieldsR   (    (    s   test_SCOP_Des.pyt
   testRecord2   s    (   t   __name__t
   __module__R   R   R   R   R"   (    (    (    s   test_SCOP_Des.pyR      s
   			
	t   __main__t	   verbosityi   t
   testRunner(   t   __doc__t   unittestt   Bio.SCOPR    t   Bio.SCOP.ResiduesR   t   TestCaseR   R#   t   TextTestRunnert   runnert   main(    (    (    s   test_SCOP_Des.pyt   <module>   s   /