ó
ûR‹_c           @   sŒ   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 m
 Z m Z d  d l m Z m Z d e f d „  ƒ  YZ d	 S(
   iÿÿÿÿ(   t   dedent(   t   TestCase(   t   Mock(   t   Document(   t   comparet
   Comparisont   TempDirectory(   t
   FileParsert	   FileBlockt   TestFileParserc           B   sb   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z RS(
   c         C   sH   t  t | ƒ d d ƒ} t t d „  t d ƒ | ƒ Dƒ ƒ d | ƒd  S(   Nt   paths	   /dev/nullc         s   s   |  ] } | j  Vq d  S(   N(   t   parsed(   t   .0t   r(    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pys	   <genexpr>   s    t   tdt   expected(   R   R    R   t   listR   (   t   selft   textR   t   d(    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   check_document   s    "c         C   sP   |  j  d d d t t d d d d d d	 ƒt t d d
 d d d d ƒg ƒ d  S(   NR   ss  
            
            .. topic:: file.txt
             :class: write-file
            
              line 1
            
              line 2
              line 3
            
            .. topic:: file2.txt
             :class: read-file
            
            
              line 4
            
              line 5
              line 6
            
            R   R
   s   file.txtt   contents   line 1

line 2
line 3
t   actiont   writes	   file2.txts   line 4

line 5
line 6
t   read(   R   t   CR   (   R   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_multiple_files   s    			c         C   s5   |  j  d d d t t d d d d d d	 ƒg ƒ d  S(
   NR   sÊ   
            .. topic:: file.txt
             :class: write-file
            
              ::
            
                line 1
            
                line 2
                line 3
            R   R
   s   file.txtR   s   line 1

line 2
line 3
R   R   (   R   R   R   (   R   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_ignore_literal_blocking5   s    		c         C   s5   |  j  d d d t t d d d d d d	 ƒg ƒ d  S(
   NR   s0  
            
            .. topic:: file.txt
             :class: write-file
            
              .. code-block:: python
            
              print "hello"
              out = 'there'
            
              foo = 'bar'
            
            This is just some normal text!
            R   R
   s   file.txtR   sA   .. code-block:: python

print "hello"
out = 'there'

foo = 'bar'
R   R   (   R   R   R   (   R   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_file_followed_by_textI   s    		c         C   s   |  j  d d d g  ƒ d  S(   NR   sŸ   
            .. topic:: file.txt
             :class: not-a-file
            
              print "hello"
              out = 'there'
            
            R   (   R   (   R   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_red_herringa   s    	c         C   s   |  j  d d d g  ƒ d  S(   NR   s‹   
            .. topic:: file.txt
            
              print "hello"
              out = 'there'
            
                        R   (   R   (   R   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_no_classn   s    	c         C   sK   t  d ƒ } t | d | j t d | d i | d 6d d d d ƒ ƒ ƒd  S(	   NR   t   actualR   t	   namespaceR
   s	   /the/filet   linei*   (   R   R   t   evaluateR   (   R   t   dirt   blockR   t   parser(    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   check_evaluatez   s    c      
   C   sH   t  ƒ  9 } | j d d ƒ |  j | t d d d ƒ d d  ƒWd  QXd  S(   Nt   fooR   R   R   (   R   R   R&   R   t   None(   R   R#   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_evaluate_read_sameƒ   s    c      
   C   sT   t  ƒ  E } | j d d ƒ |  j | t d d d ƒ d d j | j ƒ ƒWd  QXd  S(   NR'   R   R   R   sW   --- File '/the/file', line 42:
+++ Reading from "{}/foo":
@@ -1 +1 @@
-expected
+actual(   R   R   R&   R   t   formatR
   (   R   R#   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_evaluate_read_differenceŒ   s    c      
   C   sa   t  ƒ  R } |  j | t d d d ƒ d d  ƒ| j d g ƒ t | j d d ƒ d ƒ Wd  QXd  S(   NR'   R   R   R   t   ascii(   R   R&   R   R(   R   R   (   R   R#   (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   test_evaluate_write›   s    (   t   __name__t
   __module__R   R   R   R   R   R   R&   R)   R+   R-   (    (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyR	      s   		!									N(   t   textwrapR    t   unittestR   t   testfixtures.mockR   t   sybil.documentR   t   testfixturesR   R   R   R   t   testfixtures.sybilR   R   R	   (    (    (    sV   /var/www/syncserver/local/lib/python2.7/site-packages/testfixtures/tests/test_sybil.pyt   <module>   s   