
    e}-                         d Z ddlmZ ddlmZ 	 ddlZddlmZ n# e$ r  ed          w xY wddl	m
Z
mZ  G d d	e          Z G d
 de          Z G d de          Z G d de          ZdS )z5
Tests of the parsers implemented in ipython.parsers
    )SkipTest)ComparisonTestCaseN)OptsSpecz7Required dependencies not satisfied for testing parsers)CycleOptionsc                   H    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )OptsSpecPlotOptionsTestsD
    Test the OptsSpec parser works correctly for plot options.
    c                     d}ddt          dd          ii}|                     t          j        |          |           d S )Nz)Layout [fig_inches=(3,3) title='foo bar']Layoutplotfoo bar   r   title
fig_inchesr   assertEqualr   parseselflineexpecteds      Dlib/python3.11/site-packages/holoviews/tests/ipython/test_parsers.pytest_plot_opts_simplez.OptsSpecPlotOptionsTests.test_plot_opts_simple   sS    :)???AB 	--x88888    c                     d}ddt          dd          ii}|                     t          j        |          |           dS )z!Space in the tuple, see issue #77z*Layout [fig_inches=(3, 3) title='foo bar']r   r   r   r   r   Nr   r   s      r   test_plot_opts_with_spacez2OptsSpecPlotOptionsTests.test_plot_opts_with_space   sS    ;)???AB 	--x88888r   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )Nz-Layout plot[fig_inches=(3,3) title='foo bar']r   r   r   r   r   r   r   s      r   test_plot_opts_simple_explicitz7OptsSpecPlotOptionsTests.test_plot_opts_simple_explicit&   sS    >)???AB 	--x88888r   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )Nz.Layout plot[fig_inches=(3, 3) title='foo bar']r   r   r   r   r   r   r   s      r   "test_plot_opts_with_space_explicitz;OptsSpecPlotOptionsTests.test_plot_opts_with_space_explicit-   sS    ?)???AB 	--x88888r   c                     d}ddt          ddd          ii}|                     t          j        |          |           d S )Nz,Curve [fontsize={'xlabel': 10, 'title': 20}]Curver   
      xlabelr   fontsizer   r   s      r   test_plot_opts_dict_with_spacez7OptsSpecPlotOptionsTests.test_plot_opts_dict_with_space4   sO    =fg"r7R7R&S&S&STU--x88888r   c                     d}ddt          ddd          ii}|                     t          j        |          |           d S )Nz)Curve [fontsize=dict(xlabel=10,title=20)]r%   r   r&   r'   r(   r*   r   r   s      r   !test_plot_opts_dict_without_spacez:OptsSpecPlotOptionsTests.test_plot_opts_dict_without_space9   sO    :fg"r7R7R&S&S&STU--x88888r   c                     d}ddt          d          ii}|                     t          j        |          |           d S )Nz#Curve [title=', '.join(('A', 'B'))]r%   r   zA, B)r   r   r   s      r   test_plot_opts_nested_bracketsz7OptsSpecPlotOptionsTests.test_plot_opts_nested_brackets>   sG    4fgF&;&;&;<=--x88888r   c                     d}dt          dd          idt          dd          id}|                     t          j        |          |           d S )Nz/Image Curve [fig_inches=(3, 3) title='foo bar']r   r   r   r   Imager%   r   r   s      r   test_plot_opts_multiple_pathsz6OptsSpecPlotOptionsTests.test_plot_opts_multiple_pathsC   sq    @9@@@B 9@@@B	C C 	--x88888r   c                     d}dt          dd          idt          dd          idt          dd          idt          dd          id}|                     t          j        |          |           d S )Nz=Image Curve Layout Overlay[fig_inches=(3, 3) title='foo bar']r   r   r   r   r3   r%   r   Overlayr   r   s      r   test_plot_opts_multiple_paths_2z8OptsSpecPlotOptionsTests.test_plot_opts_multiple_paths_2M   s    N9@@@B 9@@@B 9@@@B 9@@@BC C 	--x88888r   N)__name__
__module____qualname____doc__r   r   r!   r#   r,   r.   r0   r4   r8    r   r   r	   r	      s         9 9 99 9 99 9 99 9 99 9 9
9 9 9
9 9 9
9 9 99 9 9 9 9r   r	   c                   J    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )OptsSpecStyleOptionsTestsc                     d}ddt          d          ii}|                     t          j        |          |           d S )NzLayout (string='foo')r   stylefoostringr   r   s      r   test_style_opts_simplez0OptsSpecStyleOptionsTests.test_style_opts_simple`   sL    &WE2224 5--x88888r   c                     d}ddt          d          ii}|                     t          j        |          |           d S )NzLayout style(string='foo')r   rA   rB   rC   r   r   s      r   test_style_opts_simple_explicitz9OptsSpecStyleOptionsTests.test_style_opts_simple_explicitf   sL    +WE2224 5--x88888r   c                     d}ddt          ddd          ii}|                     t          j        |          |           d S )Nz$Layout (string='foo' test=3, b=True)r   rA   rB   r   TrD   testbr   r   s      r   test_style_opts_intermediatez6OptsSpecStyleOptionsTests.test_style_opts_intermediatel   sZ    5WE*+'+- - -. / 	--x88888r   c                     d}ddt          ddd          ii}|                     t          j        |          |           d S )Nz*Layout style(string='foo' test=3, b=True )r   rA   rB   r   TrI   r   r   s      r   %test_style_opts_intermediate_explicitz?OptsSpecStyleOptionsTests.test_style_opts_intermediate_explicitt   sZ    ;WE*+'+- - -. / 	--x88888r   c                     d}ddt          dddt          ddg	          
          ii}|                     t          j        |          |           d S )Nz>Layout (string='foo' test=3, b=True color=Cycle(values=[1,2]))r   rA   rB   r   T      values)rD   rJ   rK   colorr   r   r   r   r   r   s      r   test_style_opts_advancedz2OptsSpecStyleOptionsTests.test_style_opts_advanced}   sq    OWE*+'++01+>+>+>@ @ @A B
 	--x88888r   c                     d}ddt          ddd          ii}|                     t          j        |          |           d S )Nz,Curve (fontsize={'xlabel': 10, 'title': 20})r%   rA   r&   r'   r(   r*   r   r   s      r   test_style_opts_dict_with_spacez9OptsSpecStyleOptionsTests.test_style_opts_dict_with_space   sP    =gw2PR8S8S'T'T'TUV--x88888r   c                     d}ddt          ddd          ii}|                     t          j        |          |           d S )Nz+Curve (fontsize={'xlabel': 10,'title': 20})r%   rA   r&   r'   r(   r*   r   r   s      r   "test_style_opts_dict_without_spacez<OptsSpecStyleOptionsTests.test_style_opts_dict_without_space   sP    <gw2PR8S8S'T'T'TUV--x88888r   c                 |   dd l }|j                            d           d}t          j        ||t
          d          }|                     d|v            |                     d|d         v            |                     d|d         d         j        v            |                     t          |d         d         j        d         t
                               |	                    g dg d	g d
g          }| 
                    |	                    |d         d         j        d         j                  |           d S )Nr   *   z5Curve (color=Cycle(values=list(np.random.rand(3,3)))))npr   r%   rA   rT   )g'w?g,Aj@l?g*r%~l?)gV"5(?g.6k?g?)giĊ"?gg?gU<?)numpyrandomseedr   r   r   
assertTruekwargs
isinstancearrayr   rS   )r   r]   r   optionsrS   s        r   test_style_opts_cycle_functionz8OptsSpecStyleOptionsTests.test_style_opts_cycle_function   sE   
	rF.b5'A'ABB7*+++77#3344477#3G#<#CCDDD
77#3G#<#CG#LeTTUUUBBBBBBBBBD E E 	''"27";"B7"K"RSS	! 	! 	! 	! 	!r   c                     d}ddt          t          g d                    ii}|                     t          j        |dt          i          |           d S )Nz+Curve (color=Cycle(values=['r', 'g', 'b']))r%   rA   )rgrK   rR   rT   r   rU   r   s      r   test_style_opts_cycle_listz4OptsSpecStyleOptionsTests.test_style_opts_cycle_list   s]    <gwU///5R5R5R'S'S'STUw.>??JJJJJr   c                     d}dt          d          idt          d          id}|                     t          j        |          |           d S )NzImage Curve (color='beautiful')rA   	beautifulrj   r2   r   r   s      r   test_style_opts_multiple_pathsz8OptsSpecStyleOptionsTests.test_style_opts_multiple_paths   si    0;///1 ;///1	2 2 	--x88888r   N)r9   r:   r;   rE   rG   rL   rN   rV   rX   rZ   rf   rk   rn   r=   r   r   r?   r?   ^   s        9 9 99 9 99 9 99 9 99 9 99 9 9
9 9 9
! ! ! K K K
9 9 9 9 9r   r?   c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )OptsNormPlotOptionsTestsr
   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )NzLayout {+axiswise}r   normTFaxiswise	framewiser   r   s      r   test_norm_opts_simple_1z0OptsNormPlotOptionsTests.test_norm_opts_simple_1   sM    #GTUCCCDF--x88888r   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )NzLayout norm{+axiswise}r   rr   TFrs   r   r   s      r    test_norm_opts_simple_explicit_1z9OptsNormPlotOptionsTests.test_norm_opts_simple_explicit_1   sM    'GTUCCCDF--x88888r   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )NzLayout {+axiswise +framewise}r   rr   Trs   r   r   s      r   test_norm_opts_simple_2z0OptsNormPlotOptionsTests.test_norm_opts_simple_2   sM    .GTTBBBCE--x88888r   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )Nz!Layout norm{+axiswise +framewise}r   rr   Trs   r   r   s      r    test_norm_opts_simple_explicit_2z9OptsNormPlotOptionsTests.test_norm_opts_simple_explicit_2   sM    2GTTBBBCE--x88888r   c                     d}dt          dd          idt          dd          id}|                     t          j        |          |           d S )Nz"Image Curve {+axiswise +framewise}rr   Trs   r2   r   r   s      r   test_norm_opts_multiple_pathsz6OptsNormPlotOptionsTests.test_norm_opts_multiple_paths   sm    3dd;;;= dd;;;=	> > 	--x88888r   N)	r9   r:   r;   r<   rv   rx   rz   r|   r~   r=   r   r   rp   rp      si         9 9 99 9 99 9 99 9 99 9 9 9 9r   rp   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )OptsSpecCombinedOptionsTestsc                     d}dt          dd          t          d          di}|                     t          j        |          |           d S )	NzALayout plot[fig_inches=(3,3) foo='bar baz'] Layout (string='foo')r   bar bazr   rB   r   rB   rC   r   rA   r   r   s      r   test_combined_1z,OptsSpecCombinedOptionsTests.test_combined_1   sa    R	f===$E2224 45 	--x88888r   c                     d}dt          dd          idt          d          id	}|                     t          j        |          |           d S )
Nz@Layout plot[fig_inches=(3,3) foo='bar baz'] Image (string='foo')r   r   r   r   rA   rB   rC   r   r3   r   r   s      r   test_combined_two_types_1z6OptsSpecCombinedOptionsTests.test_combined_two_types_1   sj    Q	f===? WE22245 5
 	--x88888r   c                     d}dt          d          it          d          t          d          d	d
}|                     t          j        |          |           d S )NzCLayout plot[fig_inches=(3, 3)] Image (string='foo') [foo='bar baz']r   r   r   rB   rC   r   )rB   )rA   r   r   r   r   s      r   test_combined_two_types_2z6OptsSpecCombinedOptionsTests.test_combined_two_types_2   sy    Tv...0 !(u 5 5 5&95557 78 8 	--x88888r   c                 H   d}t          dd          t          dd          t          d	          d
t          dd          t          dd          t          d	          d
dt          d          ii d}|                     t          j        |          |           d S )NzbImage Curve {+framewise} [fig_inches=(3, 3) title='foo bar'] (c='b') Layout [string='foo'] OverlayTF)ru   rt   r   r   r   rK   c)rr   r   rA   r   rB   rC   r6   r   r   s      r   test_combined_multiple_pathsz9OptsSpecCombinedOptionsTests.test_combined_multiple_paths   s    s te<<<9@@@s^^^% % te<<<9@@@s^^^% % E***, % & 	--x88888r   c                     d}t          d          t          dd          dt          d          t          d          dd	}|                     t          j        |          |           d S )
Nz3Image Curve [fig_inches=(3, 3)] (c='b') Image (s=3)r   r   rK   r   r   sr   r   r2   r   r   s      r   "test_combined_multiple_paths_mergez?OptsSpecCombinedOptionsTests.test_combined_multiple_paths_merge  s    D ///sa(((* * ///cNNN$ $	% 	% 	--x88888r   c                     d}ddt          dd          ii}|                     t          j        |          |           d S )NzImage (s=0, c='b') Image (s=3)r3   rA   rK   r   r   r   r   s      r   -test_combined_multiple_paths_merge_precedencezJOptsSpecCombinedOptionsTests.test_combined_multiple_paths_merge_precedence  sQ    /sa(((*+ 	--x88888r   N)	r9   r:   r;   r   r   r   r   r   r   r=   r   r   r   r      sn        9 9 99 9 99 9 99 9 9.9 9 99 9 9 9 9r   r   )r<   unittestr   holoviews.element.comparisonr   	pyparsingholoviews.util.parserr   ImportErrorholoviews.core.optionsr   r   r	   r?   rp   r   r=   r   r   <module>r      sy          ; ; ; ; ; ;N....... N N N
(L
M
MMN 2 1 1 1 1 1 1 1I9 I9 I9 I9 I91 I9 I9 I9XO9 O9 O9 O9 O9 2 O9 O9 O9f%9 %9 %9 %9 %91 %9 %9 %9PH9 H9 H9 H9 H9#5 H9 H9 H9 H9 H9s   
 ,