§
    Ètºf¬6  ã                   ó  — d dl mZ d dlZd dlZd dlZd dlmZmZ d dlZddl	m
Z
 ddlmZ d„ Zd	„ Zd
„ Z e e¦   «          d¦  «         e e¦   «          d¦  «         G d„ de¦  «        ¦   «         ¦   «         Zej         G d„ de¦  «        ¦   «         Zd„ Zd„ Z e e¦   «          d¦  «         e e¦   «          d¦  «         G d„ de¦  «        ¦   «         ¦   «         Z e e¦   «          d¦  «         e e¦   «          d¦  «         e e¦   «          d¦  «         G d„ de¦  «        ¦   «         ¦   «         ¦   «         Z e e¦   «          d¦  «         e e¦   «          d¦  «         G d„ de¦  «        ¦   «         ¦   «         Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z e e¦   «          d¦  «         e e¦   «          d¦  «         e e¦   «          d¦  «         G d „ d!e¦  «        ¦   «         ¦   «         ¦   «         ZdS )"é    )Úprint_functionN)ÚTestCaseÚskipIfé   )ÚMethodicalMachineé   )ÚisTwistedInstalledc                  óH   — 	 t          d¦  «         dS # t          $ r Y dS w xY w)z2
    Is the graphviz Python module installed?
    ÚgraphvizTF)Ú
__import__ÚImportError© ó    ú[/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/automat/_test/test_visualize.pyÚisGraphvizModuleInstalledr      s@   € ðÝ�:ÑÔÐð ˆtøõ ð ð ð Øˆuˆuðøøøs   ‚ “
! !c                  óâ   — t          j        ¦   «         \  } }t          j        |¦  «         	 t          j        d| d¬¦  «         t          j        | ¦  «         S # t          j        | ¦  «         w xY w)z+
    Are the graphviz tools installed?
    ÚdotT)ÚstdinÚshell)ÚosÚpipeÚcloseÚ
subprocessÚcall)ÚrÚws     r   ÚisGraphvizInstalledr      s]   € õ Œ7‰9Œ9�D€A€qÝ„HˆQ�K„K€KðÝ”? 5°¸Ð>Ñ>Ô>Ð>å
Œ�‰Œˆˆø�Œ�‰Œˆˆøøøs   ¬A ÁA.c                  óŠ   ‡— t          ¦   «         Š G ˆfd„dt          ¦  «        }  | ¦   «         }|                     ¦   «          ‰S )zG
    Create a sample L{MethodicalMachine} with some sample states.
    c                   ó,  •— e Zd Z”                      d¬¦  «        d„ ¦   «         Z”                      ¦   «         d„ ¦   «         Z”                      ¦   «         d„ ¦   «         Z”                      ¦   «         d„ ¦   «         Z	e 
                    eee	g¦  «         dS )ú#sampleMachine.<locals>.SampleObjectT)Úinitialc                 ó   — dS )zinitial stateNr   ©Úselfs    r   Úbeginz)sampleMachine.<locals>.SampleObject.begin.   ó   € € € r   c                 ó   — dS )z	end stateNr   r#   s    r   Úendz'sampleMachine.<locals>.SampleObject.end1   r&   r   c                 ó   — dS )zsample inputNr   r#   s    r   Úgoz&sampleMachine.<locals>.SampleObject.go4   r&   r   c                 ó   — dS )zsample outputNr   r#   s    r   Úoutz'sampleMachine.<locals>.SampleObject.out7   r&   r   N)Ú__name__Ú
__module__Ú__qualname__Ústater%   r(   Úinputr*   Úoutputr,   Úupon)Úmms   €r   ÚSampleObjectr    -   s´   ø€ € € € € Ø	�Š˜$ˆÑ	Ô	ð	ð 	ñ 
 Ô	ð	à	�Š‰Œð	ð 	ñ 
Œð	à	�Š‰Œð	ð 	ñ 
Œð	à	�Š‰Œð	ð 	ñ 
Œð	à�
Š
�2�s˜S˜EÑ"Ô"Ð"Ð"Ð"r   r5   )r   Úobjectr*   )r5   Úsor4   s     @r   ÚsampleMachiner8   (   sc   ø€ õ 
Ñ	Ô	€Bð#ð #ð #ð #ð #ð #ð #•vñ #ô #ð #ð 
ˆ‰Œ€BØ‡E‚E�G„G€GØ€Ir   z!Graphviz module is not installed.zTwisted is not installed.c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚElementMakerTestszL
    L{elementMaker} generates HTML representing the specified element.
    c                 ó    — ddl m} || _        d S )Nr   )ÚelementMaker)Ú
_visualizer<   )r$   r<   s     r   ÚsetUpzElementMakerTests.setUpG   s"   € Ø-Ð-Ð-Ð-Ð-Ð-Ø(ˆÔÐÐr   c           	      ód   — d}|                       ||                      dddd¬¦  «        ¦  «         dS )zK
        L{elementMaker} orders HTML attributes lexicographically.
        z<div a="1" b="2" c="3"></div>ÚdivÚ2Ú1Ú3©ÚbÚaÚcN©ÚassertEqualr<   ©r$   Úexpecteds     r   Útest_sortsAttrsz!ElementMakerTests.test_sortsAttrsK   sP   € ð 4ˆØ×Ò˜Ø×*Ò*¨5Ø-0Ø-0Ø-0ð +ñ 2ô 2ñ	3ô 	3ð 	3ð 	3ð 	3r   c           	      ód   — d}|                       ||                      dddd¬¦  «        ¦  «         dS )z¡
        L{elementMaker} quotes HTML attributes according to DOT's quoting rule.

        See U{http://www.graphviz.org/doc/info/lang.html}, footnote 1.
        z-<div a="1" b="a \" quote" c="a string"></div>r@   z	a " quoter   za stringrD   NrH   rJ   s     r   Útest_quotesAttrsz"ElementMakerTests.test_quotesAttrsV   sQ   € ð DˆØ×Ò˜Ø×*Ò*¨5Ø-8Ø-.Ø-7ð +ñ 9ô 9ñ	:ô 	:ð 	:ð 	:ð 	:r   c                 ó\   — d}|                       ||                      d¦  «        ¦  «         dS )zN
        L{elementMaker} should render an element with no attributes.
        z<div ></div>r@   NrH   rJ   s     r   Útest_noAttrszElementMakerTests.test_noAttrsc   s3   € ð #ˆØ×Ò˜ 4×#4Ò#4°UÑ#;Ô#;Ñ<Ô<Ð<Ð<Ð<r   N)r-   r.   r/   Ú__doc__r>   rL   rN   rP   r   r   r   r:   r:   @   sZ   € € € € € ðð ð)ð )ð )ð	3ð 	3ð 	3ð:ð :ð :ð=ð =ð =ð =ð =r   r:   c                   ól   — e Zd ZdZ ej        ¦   «         Z ej        ¦   «         Z ej        ¦   «         ZdS )ÚHTMLElementz2Holds an HTML element, as created by elementMaker.N)	r-   r.   r/   rQ   ÚattrÚibÚnameÚchildrenÚ
attributesr   r   r   rS   rS   k   s;   € € € € € à<Ð<Øˆ4Œ7‰9Œ9€DØˆtŒw‰yŒy€HØ�”‘”€J€J€Jr   rS   c                 óh   ‡—  ‰| ¦  «        r| gS t          | ¦  «        rg S ˆfd„| j        D ¦   «         S )zk
    Recursively collect all elements in an L{HTMLElement} tree that
    match the optional predicate.
    c                 ó:   •— g | ]}t          |‰¦  «        D ]}|‘ŒŒS r   )ÚfindElements)Ú.0ÚchildÚresultÚ	predicates      €r   ú
<listcomp>z findElements.<locals>.<listcomp>}   sH   ø€ ð :ð :ð :ØÝ& u¨iÑ8Ô8ð:ð :àð ð :ð :ð :ð :r   )ÚisLeafrW   )Úelementr_   s    `r   r[   r[   s   s`   ø€ ð
 €y�ÑÔð ØˆyÐÝ	�‰Œð Øˆ	ð:ð :ð :ð :Ø Ô)ð:ñ :ô :ð :r   c                 ó.   — t          | t          ¦  «         S )z2
    This HTML element is actually leaf node.
    )Ú
isinstancerS   ©rb   s    r   ra   ra   ‚   s   € õ ˜'¥;Ñ/Ô/Ð/Ð/r   c                   ó0   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚTableMakerTestszÚ
    Tests that ensure L{tableMaker} generates HTML tables usable as
    labels in DOT graphs.

    For more information, read the "HTML-Like Labels" section of
    U{http://www.graphviz.org/doc/info/shapes.html}.
    c                 ó&   — t          |||¬¦  «        S )N)rV   rW   rX   )rS   )r$   rV   rW   rX   s       r   ÚfakeElementMakerz TableMakerTests.fakeElementMaker”   s   € Ý ¨xÀJÐOÑOÔOÐOr   c                 ón   — ddl m} d| _        d| _        t	          j        || j        ¬¦  «        | _        d S )Nr   )Ú
tableMakerúinput labelzthe port)Ú_E)r=   rk   Ú
inputLabelÚportÚ	functoolsÚpartialri   )r$   rk   s     r   r>   zTableMakerTests.setUp—   sJ   € Ø+Ð+Ð+Ð+Ð+Ð+à'ˆŒØˆŒ	Ý#Ô+¨JØ/3Ô/DðFñ Fô FˆŒˆˆr   c                 óÖ  ‡ — ˆ fd„}g dgfD ]Ü}‰                       ‰ j        |‰ j        ¬¦  «        }‰                      t	          |j        ¦  «        d¦  «         |j        d         }t          ||¦  «        }‰                      t	          |¦  «        d¦  «         ‰                      |d         j        d¦  «         ‰                      t          |t          ¦  «        ‰ j        g¦  «         ŒÝdS )zÍ
        The table returned by L{tableMaker} always contains the input
        symbol label in its first row, and that row contains one cell
        with a port attribute set to the provided port.
        c                 ój   •— t          | ¦  «         o"| j                             d¦  «        ‰j        k    S )Nro   )ra   rX   Úgetro   )rb   r$   s    €r   ÚhasPortz3TableMakerTests.test_inputLabelRow.<locals>.hasPort¦   s6   ø€ Ý˜w™œÐ'ð DØÔ*×.Ò.¨vÑ6Ô6¸$¼)ÒCðEr   zan output label©ro   r   r   ÚtdN)
rk   rn   ro   ÚassertGreaterÚlenrW   r[   rI   rV   ra   )r$   ru   ÚoutputLabelsÚtableÚinputLabelRowÚportCandidatess   `     r   Útest_inputLabelRowz"TableMakerTests.test_inputLabelRowŸ   s  ø€ ð	Eð 	Eð 	Eð 	Eð 	Eð  Ð"3Ð!4Ð5ð 	0ð 	0ˆLØ—O’O D¤O°\Ø)-¬ð $ñ 4ô 4ˆEà×Ò�s 5¤>Ñ2Ô2°AÑ6Ô6Ð6Ø!œN¨1Ô-ˆMå)¨%°Ñ9Ô9ˆNà×Ò�S Ñ0Ô0°!Ñ4Ô4Ð4Ø×Ò˜^¨AÔ.Ô3°TÑ:Ô:Ð:Ø×Ò�\¨-½Ñ@Ô@Ø"œoÐ.ñ0ô 0ð 0ð 0ð	0ð 	0r   c                 óØ   — |                       dd| j        ¬¦  «        }|                      t          |j        ¦  «        d¦  «         |j        \  }|                      d|j        ¦  «         dS )z�
        L{tableMaker} does not add a colspan attribute to the input
        label's cell or a second row if there no output labels.
        rl   r   rv   r   ÚcolspanN)rk   ro   rI   ry   rW   ÚassertNotInrX   )r$   r{   r|   s      r   Útest_noOutputLabelsz#TableMakerTests.test_noOutputLabels·   sf   € ð
 —’ ¨r¸¼	�ÑBÔBˆØ×Ò�˜Uœ^Ñ,Ô,¨aÑ0Ô0Ð0Ø œ>ÑˆØ×Ò˜ MÔ$<Ñ=Ô=Ð=Ð=Ð=r   c                 ól  — |                       | j        d| j        ¬¦  «        }|                      t	          |j        ¦  «        d¦  «         |j        \  }}d„ }|                      t	          t          ||¦  «        ¦  «        d¦  «         |                      t          |t          ¦  «        ddg¦  «         dS )	z¹
        L{tableMaker} adds a colspan attribute to the input label's cell
        equal to the number of output labels and a second row that
        contains the output labels.
        )úoutput label 1úoutput label 2rv   r   c                 ót   — t          | ¦  «         o(| j        dk    o| j                             d¦  «        dk    S )Nrw   r€   rA   )ra   rV   rX   rt   re   s    r   ÚhasCorrectColspanz@TableMakerTests.test_withOutputLabels.<locals>.hasCorrectColspanÎ   sC   € Ý˜w™œÐ'ð AØœ¨Ò,ðAàÔ*×.Ò.¨yÑ9Ô9¸SÒ@ðBr   r   r„   r…   N)rk   rn   ro   rI   ry   rW   r[   ra   )r$   r{   ÚinputRowÚ	outputRowr‡   s        r   Útest_withOutputLabelsz%TableMakerTests.test_withOutputLabelsÁ   sÜ   € ð —’ ¤ð 2Dà%)¤Yð  ñ 0ô 0ˆð 	×Ò�˜Uœ^Ñ,Ô,¨aÑ0Ô0Ð0Ø#œnÑˆ�)ð	Bð 	Bð 	Bð
 	×Ò��\¨(Ð4EÑFÔFÑGÔGØñ	ô 	ð 	à×Ò� iµÑ8Ô8Ð;KØ;Kð;Mñ 	Nô 	Nð 	Nð 	Nð 	Nr   N)	r-   r.   r/   rQ   ri   r>   r~   r‚   rŠ   r   r   r   rg   rg   ‰   st   € € € € € ðð ðPð Pð PðFð Fð Fð0ð 0ð 0ð0>ð >ð >ðNð Nð Nð Nð Nr   rg   z!Graphviz tools are not installed.c                   ó   — e Zd ZdZd„ ZdS )ÚIntegrationTestsz[
    Tests which make sure Graphviz can understand the output produced by
    Automat.
    c                 óJ  — t          j        dt           j        t           j        ¬¦  «        }|                     d                     t          ¦   «                              ¦   «         ¦  «                             d¦  «        ¦  «        \  }}|                      |j	        d¦  «         dS )z8
        L{graphviz} emits valid graphviz data.
        r   )r   ÚstdoutÚ zutf-8r   N)
r   ÚPopenÚPIPEÚcommunicateÚjoinr8   Ú	asDigraphÚencoderI   Ú
returncode)r$   Úpr,   Úerrs       r   Útest_validGraphvizz#IntegrationTests.test_validGraphvizâ   s„   € õ Ô˜U­*¬/Ý$.¤Oð5ñ 5ô 5ˆà—=’= §¢­©¬×)BÒ)BÑ)DÔ)DÑ!EÔ!Eß"(¢&¨¡/¤/ñ3ô 3‰ˆˆSà×Ò˜œ qÑ)Ô)Ð)Ð)Ð)r   N)r-   r.   r/   rQ   r™   r   r   r   rŒ   rŒ   Ù   s-   € € € € € ðð ð
*ð *ð *ð *ð *r   rŒ   c                   ó   — e Zd ZdZd„ ZdS )Ú
SpotCheckszj
    Tests to make sure that the output contains salient features of the machine
    being generated.
    c                 ó  — d                      t          ¦   «                              ¦   «         ¦  «        }|                      d|¦  «         |                      d|¦  «         |                      d|¦  «         |                      d|¦  «         dS )z�
        The output of L{graphviz} should contain the names of the states,
        inputs, outputs in the state machine.
        r�   r%   r(   r*   r,   N)r“   r8   r”   ÚassertIn)r$   Úgvouts     r   Útest_containsMachineFeaturesz'SpotChecks.test_containsMachineFeaturesõ   s{   € ð
 —’�™œ×1Ò1Ñ3Ô3Ñ4Ô4ˆØ�Š�g˜uÑ%Ô%Ð%Ø�Š�e˜UÑ#Ô#Ð#Ø�Š�d˜EÑ"Ô"Ð"Ø�Š�e˜UÑ#Ô#Ð#Ð#Ð#r   N)r-   r.   r/   rQ   rŸ   r   r   r   r›   r›   í   s-   € € € € € ðð ð
	$ð 	$ð 	$ð 	$ð 	$r   r›   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚRecordsDigraphActionsz/
    Records calls made to L{FakeDigraph}.
    c                 ó.   — |                       ¦   «          d S ©N)Úresetr#   s    r   Ú__init__zRecordsDigraphActions.__init__  s   € Ø�
Š
‰Œˆˆˆr   c                 ó"   — g | _         g | _        d S r£   )ÚrenderCallsÚ	saveCallsr#   s    r   r¤   zRecordsDigraphActions.reset	  s   € ØˆÔØˆŒˆˆr   N)r-   r.   r/   rQ   r¥   r¤   r   r   r   r¡   r¡     s<   € € € € € ðð ðð ð ðð ð ð ð r   r¡   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚFakeDigraphzZ
    A fake L{graphviz.Digraph}.  Instantiate it with a
    L{RecordsDigraphActions}.
    c                 ó   — || _         d S r£   )Ú	_recorder)r$   Úrecorders     r   r¥   zFakeDigraph.__init__  s   € Ø!ˆŒˆˆr   c                 óD   — | j         j                             |¦  «         d S r£   )r¬   r§   Úappend©r$   Úkwargss     r   ÚrenderzFakeDigraph.render  s!   € ØŒÔ"×)Ò)¨&Ñ1Ô1Ð1Ð1Ð1r   c                 óD   — | j         j                             |¦  «         d S r£   )r¬   r¨   r¯   r°   s     r   ÚsavezFakeDigraph.save  s!   € ØŒÔ ×'Ò'¨Ñ/Ô/Ð/Ð/Ð/r   N)r-   r.   r/   rQ   r¥   r²   r´   r   r   r   rª   rª     sK   € € € € € ðð ð
"ð "ð "ð2ð 2ð 2ð0ð 0ð 0ð 0ð 0r   rª   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚFakeMethodicalMachinezL
    A fake L{MethodicalMachine}.  Instantiate it with a L{FakeDigraph}
    c                 ó   — || _         d S r£   ©Ú_digraph)r$   Údigraphs     r   r¥   zFakeMethodicalMachine.__init__#  s   € ØˆŒˆˆr   c                 ó   — | j         S r£   r¸   r#   s    r   r”   zFakeMethodicalMachine.asDigraph&  s
   € ØŒ}Ðr   N)r-   r.   r/   rQ   r¥   r”   r   r   r   r¶   r¶     s<   € € € € € ðð ð ð  ð  ðð ð ð ð r   r¶   c                   óV   — e Zd Zd„ Zd„ Zd„ Z	 	 	 	 	 dd„Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ ZdS )ÚVisualizeToolTestsc                 ó˜   — t          ¦   «         | _        t          | j        ¦  «        | _        d| _        dg| _        g | _        d| _        d S )Nz	tool-testÚignoredz	fake.fqpn)r¡   ÚdigraphRecorderrª   ÚfakeDigraphÚfakePrognameÚfakeSysPathÚcollectedOutputÚfakeFQPNr#   s    r   r>   zVisualizeToolTests.setUp/  sH   € Ý4Ñ6Ô6ˆÔÝ& tÔ';Ñ<Ô<ˆÔà'ˆÔØ%˜;ˆÔØ!ˆÔØ#ˆŒˆˆr   c                 ó`   — | j                              d                     |¦  «        ¦  «         d S )Nú )rÄ   r¯   r“   )r$   Úargss     r   ÚcollectPrintsz VisualizeToolTests.collectPrints8  s)   € ØÔ×#Ò# C§H¢H¨T¡N¤NÑ3Ô3Ð3Ð3Ð3r   c              #   ó:   K  — |t          | j        ¦  «        fV — d S r£   )r¶   rÁ   )r$   Úfqpns     r   ÚfakeFindMachinesz#VisualizeToolTests.fakeFindMachines;  s)   è è € ØÕ)¨$Ô*:Ñ;Ô;Ð;Ð;Ð;Ð;Ð;Ð;r   Nc                 óv   — ddl m}  ||p| j        |p| j        g|p| j        |p| j        |p| j        ¬¦  «        S )Nr   )Útool)Ú	_prognameÚ_argvÚ_syspathÚ_findMachinesÚ_print)r=   rÎ   rÂ   rÅ   rÃ   rÌ   rÉ   )r$   ÚprognameÚargvÚsyspathÚfindMachinesÚprintrÎ   s          r   rÎ   zVisualizeToolTests.tool>  sg   € ð 	&Ð%Ð%Ð%Ð%Ð%ØˆtØÐ3 $Ô"3ØÐ)˜4œ=˜/ØÐ0 Ô 0Ø&Ð?¨$Ô*?ØÐ.˜DÔ.ð0ñ 0ô 0ð 	0r   c                 ó€   — |                       | j        g¬¦  «         |                      | j        d         d¦  «         dS )z‰
        L{tool} adds '' to sys.path to ensure
        L{automat._discover.findMachines} searches the current
        directory.
        ©rÕ   r   r�   N)rÎ   rÅ   rI   rÃ   r#   s    r   Útest_checksCurrentDirectoryz.VisualizeToolTests.test_checksCurrentDirectoryL  s@   € ð 	�	Š	˜œ�ˆ	Ñ'Ô'Ð'Ø×Ò˜Ô)¨!Ô,¨bÑ1Ô1Ð1Ð1Ð1r   c                 óâ   — |                       | j        dg¬¦  «         |                      | j        ¦  «         |                       | j        dg¬¦  «         |                      | j        ¦  «         dS )z6
        Passing -q/--quiet hides all output.
        z--quietrÚ   z-qN)rÎ   rÅ   ÚassertFalserÄ   r#   s    r   Útest_quietHidesOutputz(VisualizeToolTests.test_quietHidesOutputU  sn   € ð 	�	Š	˜œ yÐ1ˆ	Ñ2Ô2Ð2Ø×Ò˜Ô-Ñ.Ô.Ð.Ø�	Š	˜œ tÐ,ˆ	Ñ-Ô-Ð-Ø×Ò˜Ô-Ñ.Ô.Ð.Ð.Ð.r   c                 ó  — dD �] }| j                              ¦   «          g | _        |                      | j        |dg¬¦  «         |                      t          d„ | j        D ¦   «         ¦  «        ¦  «         |                      t          | j         j	        ¦  «        d¦  «         | j         j	        \  }|                      d 
                    | j        ¦  «        |d         ¦  «         |                      | j         j        ¦  «         �ŒdS )	ze
        Passing an empty string for --image-directory/-i disables
        rendering images.
        )ú--image-directoryz-ir�   rÚ   c              3   ó   K  — | ]}d |v V — Œ	dS ©ÚimageNr   ©r\   Úlines     r   ú	<genexpr>z6VisualizeToolTests.test_onlySaveDot.<locals>.<genexpr>h  sB   è è € ð !Cð !CØ%)ð ")¨D ð !Cð !Cð !Cð !Cð !Cð !Cr   r   ú{}.dotÚfilenameN)rÀ   r¤   rÄ   rÎ   rÅ   rÝ   ÚanyrI   ry   r¨   Úformatr§   ©r$   Úargr   s      r   Útest_onlySaveDotz#VisualizeToolTests.test_onlySaveDot^  s&  € ð
 /ð 	?ñ 	?ˆCØÔ ×&Ò&Ñ(Ô(Ð(Ø#%ˆDÔ à�IŠI˜DœM¨3°Ð3ˆIÑ4Ô4Ð4Ø×Ò�Sð !Cð !CØ-1Ô-Að!Cñ !Cô !Cñ Cô Cñ Dô Dð Dð ×Ò�S Ô!5Ô!?Ñ@Ô@À!ÑDÔDÐDØÔ*Ô4‰GˆTØ×Ò˜XŸ_š_¨T¬]Ñ;Ô;Ø! *Ô-ñ/ô /ð /ð ×Ò˜TÔ1Ô=Ñ>Ô>Ð>Ñ>ð	?ð 	?r   c                 óD  — dD �]}| j                              ¦   «          g | _        |                      | j        |dg¬¦  «         |                      t          d„ | j        D ¦   «         ¦  «        ¦  «         |                      t          | j         j	        ¦  «        d¦  «         | j         j	        \  }|                      d 
                    | j        ¦  «        |d         ¦  «         |                      |d         ¦  «         |                      | j         j        ¦  «         �Œd	S )
zc
        Passing an empty string for --dot-directory/-d disables saving dot
        files.
        )ú--dot-directoryz-dr�   rÚ   c              3   ó   K  — | ]}d |v V — Œ	dS ©r   Nr   rä   s     r   ræ   z8VisualizeToolTests.test_saveOnlyImage.<locals>.<genexpr>|  sB   è è € ð !Cð !CØ%)ð "'¨$ ð !Cð !Cð !Cð !Cð !Cð !Cr   r   rç   rè   ÚcleanupN)rÀ   r¤   rÄ   rÎ   rÅ   rÝ   ré   rI   ry   r§   rê   Ú
assertTruer¨   rë   s      r   Útest_saveOnlyImagez%VisualizeToolTests.test_saveOnlyImager  s:  € ð
 -ð 	=ñ 	=ˆCØÔ ×&Ò&Ñ(Ô(Ð(Ø#%ˆDÔ Ø�IŠI˜DœM¨3°Ð3ˆIÑ4Ô4Ð4à×Ò�Sð !Cð !CØ-1Ô-Að!Cñ !Cô !Cñ Cô Cñ Dô Dð Dð ×Ò�S Ô!5Ô!AÑBÔBÀAÑFÔFÐFØÔ*Ô6‰GˆTØ×Ò˜XŸ_š_¨T¬]Ñ;Ô;Ø! *Ô-ñ/ô /ð /à�OŠO˜D œOÑ,Ô,Ð,à×Ò˜TÔ1Ô;Ñ<Ô<Ð<Ñ<ð	=ð 	=r   c                 ó¤  — d}d}|                       | j        d|d|g¬¦  «         |                      t          d„ | j        D ¦   «         ¦  «        ¦  «         |                      t          d„ | j        D ¦   «         ¦  «        ¦  «         |                      t          | j        j        ¦  «        d¦  «         | j        j        \  }|                      |d	         |¦  «         |                      |d
         ¦  «         |                      t          | j        j	        ¦  «        d¦  «         | j        j	        \  }|                      |d	         |¦  «         dS )z’
        Passing different directories to --image-directory and --dot-directory
        writes images and dot files to those directories.
        rã   r   rà   rï   rÚ   c              3   ó   K  — | ]}d |v V — Œ	dS râ   r   rä   s     r   ræ   zQVisualizeToolTests.test_saveDotAndImagesInDifferentDirectories.<locals>.<genexpr>’  s:   è è € ð >ð >Ø $ð $ t˜Oð >ð >ð >ð >ð >ð >r   c              3   ó   K  — | ]}d |v V — Œ	dS rñ   r   rä   s     r   ræ   zQVisualizeToolTests.test_saveDotAndImagesInDifferentDirectories.<locals>.<genexpr>”  s:   è è € ð >ð >Ø $ð " T˜Mð >ð >ð >ð >ð >ð >r   r   Ú	directoryrò   N)
rÎ   rÅ   ró   ré   rÄ   rI   ry   rÀ   r§   r¨   )r$   ÚimageDirectoryÚdotDirectoryÚ
renderCallÚsaveCalls        r   Ú+test_saveDotAndImagesInDifferentDirectoriesz>VisualizeToolTests.test_saveDotAndImagesInDifferentDirectories‡  st  € ð
 !ˆØˆØ�	Š	˜œØ+¨^Ø)¨<ð9ˆ	ñ 	:ô 	:ð 	:ð 	�Š�ð >ð >Ø(,Ô(<ð>ñ >ô >ñ >ô >ñ 	?ô 	?ð 	?à�Š�ð >ð >Ø(,Ô(<ð>ñ >ô >ñ >ô >ñ 	?ô 	?ð 	?ð 	×Ò�˜TÔ1Ô=Ñ>Ô>ÀÑBÔBÐBØÔ,Ô8‰ˆØ×Ò˜ KÔ0°.ÑAÔAÐAØ�Š˜
 9Ô-Ñ.Ô.Ð.à×Ò�˜TÔ1Ô;Ñ<Ô<¸aÑ@Ô@Ð@ØÔ*Ô4‰ˆØ×Ò˜ +Ô.°Ñ=Ô=Ð=Ð=Ð=r   c                 óè  — d}|                       | j        d|d|g¬¦  «         |                      t          d„ | j        D ¦   «         ¦  «        ¦  «         |                      t          | j        j        ¦  «        d¦  «         | j        j        \  }|                      |d         |¦  «         |  	                    |d         ¦  «         |  	                    t          | j        j
        ¦  «        ¦  «         d	S )
z�
        Passing the same directory to --image-directory and --dot-directory
        writes images and dot files to that one directory.
        ÚimagesAndDotrà   rï   rÚ   c              3   ó   K  — | ]}d |v V — Œ	dS )zimage and dotNr   rä   s     r   ræ   zJVisualizeToolTests.test_saveDotAndImagesInSameDirectory.<locals>.<genexpr>ª  s;   è è € ð >ð >Ø $ð ,¨tÐ3ð >ð >ð >ð >ð >ð >r   r   rø   rò   N)rÎ   rÅ   ró   ré   rÄ   rI   ry   rÀ   r§   rÝ   r¨   )r$   rø   rû   s      r   Ú$test_saveDotAndImagesInSameDirectoryz7VisualizeToolTests.test_saveDotAndImagesInSameDirectory   s  € ð
 #ˆ	Ø�	Š	˜œØ+¨YØ)¨9ð6ˆ	ñ 	7ô 	7ð 	7ð 	�Š�ð >ð >Ø(,Ô(<ð>ñ >ô >ñ >ô >ñ 	?ô 	?ð 	?ð 	×Ò�˜TÔ1Ô=Ñ>Ô>ÀÑBÔBÐBØÔ,Ô8‰ˆØ×Ò˜ KÔ0°)Ñ<Ô<Ð<Ø×Ò˜ IÔ.Ñ/Ô/Ð/à×Ò�˜TÔ1Ô;Ñ<Ô<Ñ=Ô=Ð=Ð=Ð=r   )NNNNN)r-   r.   r/   r>   rÉ   rÌ   rÎ   rÛ   rÞ   rí   rô   rý   r  r   r   r   r½   r½   *  sÀ   € € € € € ð
$ð $ð $ð4ð 4ð 4ð<ð <ð <ð ØØØØð0ð 0ð 0ð 0ð2ð 2ð 2ð/ð /ð /ð?ð ?ð ?ð(=ð =ð =ð*>ð >ð >ð2>ð >ð >ð >ð >r   r½   )Ú
__future__r   rp   r   r   Úunittestr   r   rT   Ú_methodicalr   Útest_discoverr	   r   r   r8   r:   Úsr6   rS   r[   ra   rg   rŒ   r›   r¡   rª   r¶   r½   r   r   r   ú<module>r     sC  ðØ %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð à 	€	€	€	Ø Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à €€€à +Ð +Ð +Ð +Ð +Ð +à -Ð -Ð -Ð -Ð -Ð -ð	ð 	ð 	ð	ð 	ð 	ðð ð ð0 €Ð%Ð%Ñ'Ô'Ð'Ð)LÑMÔMØ€ÐÐÑ Ô Ð Ð"=Ñ>Ô>ð&=ð &=ð &=ð &=ð &=˜ñ &=ô &=ñ ?Ô>ñ NÔMð&=ðR „ðð ð ð ð �&ñ ô ñ „ðð:ð :ð :ð0ð 0ð 0ð €Ð%Ð%Ñ'Ô'Ð'Ð)LÑMÔMØ€ÐÐÑ Ô Ð Ð"=Ñ>Ô>ðKNð KNð KNð KNð KN�hñ KNô KNñ ?Ô>ñ NÔMðKNð\ €Ð%Ð%Ñ'Ô'Ð'Ð)LÑMÔMØ€ÐÐÑ!Ô!Ð!Ð#FÑGÔGØ€ÐÐÑ Ô Ð Ð"=Ñ>Ô>ð*ð *ð *ð *ð *�xñ *ô *ñ ?Ô>ñ HÔGñ NÔMð*ð" €Ð%Ð%Ñ'Ô'Ð'Ð)LÑMÔMØ€ÐÐÑ Ô Ð Ð"=Ñ>Ô>ð$ð $ð $ð $ð $�ñ $ô $ñ ?Ô>ñ NÔMð$ð$
ð 
ð 
ð 
ð 
˜Fñ 
ô 
ð 
ð0ð 0ð 0ð 0ð 0�&ñ 0ô 0ð 0ð 	ð 	ð 	ð 	ð 	˜Fñ 	ô 	ð 	ð €Ð%Ð%Ñ'Ô'Ð'Ð)LÑMÔMØ€ÐÐÑ!Ô!Ð!Ð#FÑGÔGØ€ÐÐÑ Ô Ð Ð"=Ñ>Ô>ðE>ð E>ð E>ð E>ð E>˜ñ E>ô E>ñ ?Ô>ñ HÔGñ NÔMðE>ð E>ð E>r   