ó
š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(   sF   Unit test for Dom

This test requires the mini DOM file 'testDom.txt'
iÿÿÿÿN(   t   Dom(   t   Residuest   DomTestsc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   d |  _  d  S(   Ns   ./SCOP/testDom.txt(   t   filename(   t   self(    (    s   test_SCOP_Dom.pyt   setUp   s    c         C   s_   t  |  j ƒ } z> d } x! t j | ƒ D] } | d 7} q( W|  j | d ƒ Wd  | j ƒ  Xd  S(   Ni    i   i
   (   t   openR   R    t   parset   assertEqualst   close(   R   t   ft   countt   record(    (    s   test_SCOP_Dom.pyt	   testParse   s    c         C   sg   t  |  j ƒ } zF x? | D]7 } t j | ƒ } |  j t | ƒ j ƒ  | j ƒ  ƒ q WWd  | j ƒ  Xd  S(   N(   R   R   R    t   RecordR   t   strt   rstripR	   (   R   R
   t   lineR   (    (    s   test_SCOP_Dom.pyt   testStr"   s    *c         C   s    d } |  j  t t j | ƒ d  S(   Ns   49xxx268	sp	b.1.2.1	-
(   t   assertRaisest
   ValueErrorR    R   (   R   t
   corruptDom(    (    s   test_SCOP_Dom.pyt	   testError,   s    c         C   sk   d } t  j | ƒ } |  j | j d ƒ |  j | j j d ƒ |  j | j j d ƒ |  j | j d ƒ d  S(	   Ns%   d7hbib_	7hbi	b:	1.001.001.001.001.001t   d7hbib_t   7hbit   bt    s   1.001.001.001.001.001(   R   R   R   (   (   R   R   R   (   R    R   R   t   sidt   residuest   pdbidt	   fragmentst	   hierarchy(   R   t   recLinet   rec(    (    s   test_SCOP_Dom.pyt
   testRecord1   s    (   t   __name__t
   __module__R   R   R   R   R"   (    (    (    s   test_SCOP_Dom.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_Dom.pyt   <module>
   s   (