
    ;;iM                         d dl Z d dlZd dlZd dlZd dlmZ d dlZddlmZm	Z	 ddZ
ddZd Zd Z e
ej                  d	k(  d
      Z e
ej                  d	k7  d      Z e
ej                  j#                  d       d      Zej                  dvxr e j&                  j)                  dd      dk(  ZdZ e
ee      Zd Z ed      Z ed      Zd Z	  ej8                  d      ZdZej?                           eed      Z!d Z"y# e $ r dZY w xY w)    N)import_module   )	ipdoctestipdocstringc                 p    |d}t        | t              sJ t        j                  j	                  | |      S )a  Make function raise SkipTest exception if skip_condition is true

    Parameters
    ----------

    skip_condition : bool or callable
      Flag to determine whether to skip test. If the condition is a
      callable, it is used at runtime to dynamically make the decision. This
      is useful for tests that may require costly imports, to delay the cost
      until the test suite is actually executed.
    msg : string
      Message to give on raising a SkipTest exception.

    Returns
    -------
    decorator : function
      Decorator, which, when applied to a function, causes SkipTest
      to be raised when the skip_condition was True, and the function
      to be called normally otherwise.
    z#Test skipped due to test condition.reason)
isinstanceboolpytestmarkskipif)skip_conditionmsgs     W/home/rose/Desktop/poly/venv/lib/python3.12/site-packages/IPython/testing/decorators.pyr   r      s8    * {3nd+++;;nS99    c                 T    | rt        | t              st        d      t        d|       S )aW  Decorator factory - mark a test function for skipping from test suite.

    Parameters
    ----------
      msg : string
        Optional message to be added.

    Returns
    -------
       decorator : function
         Decorator, which, when applied to a function, causes SkipTest
         to be raised, with the optional message added.
    zSinvalid object passed to `@skip` decorator, did you meant `@skip()` with brackets ?T)r
   str
ValueErrorr   )r   s    r   skipr   *   s1     :c3'.
 	
 $r   c                     t        |  |      S )z0The reverse from skipif, see skipif for details.)r   )	conditionr   s     r   onlyifr   @   s     i-%%r   c                 F    	 t        |       }d}|S # t        $ r d}Y |S w xY w)zCan module be imported?  Returns true if module does NOT import.

    This is used to make a decorator to skip tests that require module to be
    available, but delay the 'import numpy' to test execution time.
    FT)r   ImportError)modulemodmod_not_avails      r   module_not_availabler   H   s:    F#   s      win32z$This test does not run under Windowsz!This test only runs under WindowsdarwinzThis test only runs under macOS)r!   r    DISPLAY z.Skipped under *nix when X11/XOrg not availablec                 2    t        t        |       d| z        S )NzThis test requires %s)r   r   )r   s    r   <lambda>r%   n   s    66<r   numpy
matplotlibc                     | S N )fs    r   r%   r%   x   s    ar   u   tmp€)prefixTFzCThis test is only applicable where we can use unicode in filenames.c                      | D ]?  }d| d}t        j                  |      rt        j                  j	                  |      c S  t
        S )zN
    Decorator to skip test when at least one of `commands` is not found.
    z This test runs only if command 'z' is installedr   )shutilwhichr   r   r   	null_deco)commandscmdr	   s      r   onlyif_cmds_existr3      sH     3C5G||C ;;##6#22  r   r)   )#osr.   systempfile	importlibr   r   
ipunittestr   r   r   r   r   r   platform
skip_win32skip_if_not_win32
startswithskip_if_not_osxenvironget_x11_skip_cond_x11_skip_msgskip_if_no_x11skip_withoutskipif_not_numpyskipif_not_matplotlibr0   NamedTemporaryFiler+   unicode_pathscloseUnicodeEncodeErroronlyif_unicode_pathsr3   r*   r   r   <module>rK      s>   	  
  #  /:<,&& CLLG+-ST
 3<<724WX ))+L
 LL++S

y"0MQS0S  A6
  ( $\2  	###84A
 MGGIJ   Ms   D DD