
    ni                        S r SSKJr  SSKJr  SSKJr  SSKrSSKJs  Jr	  SSK
Jr   " S S\	R                  R                  5      r " S	 S
\5      r " S S\R"                  5      r\S:X  a  \	R                  R)                  5         gg)zTests for environment wrappers.    )absolute_import)division)print_functionN)toolsc                   ,    \ rS rSrS rS rS rS rSrg)ExternalProcessTest   c                     [         R                  " [        R                  SSSSS9n[        R                  R                  U5      nUR                  5         g )N      r   r   observ_shapeaction_shapemin_durationmax_duration)	functoolspartialr   MockEnvironmentwrappersExternalProcesscloseselfconstructorenvs      k/home/james-whalen/.local/lib/python3.13/site-packages/pybullet_envs/minitaur/agents/tools/wrappers_test.pytest_close_no_hang_after_init1ExternalProcessTest.test_close_no_hang_after_init   sE    ##E$9$917151212	4K
 ..
(
(
5CIIK    c                 r   [         R                  " [        R                  SSSSS9n[        R                  R                  U5      nUR                  5         UR                  UR                  R                  5       5        UR                  UR                  R                  5       5        UR                  5         g )Nr   r      r   )r   r   r   r   r   r   resetstepaction_spacesampler   r   s      r   test_close_no_hang_after_step1ExternalProcessTest.test_close_no_hang_after_step&   s    ##E$9$917151212	4K
 ..
(
(
5CIIKHHS$$&'HHS$$&'IIKr!   c                     [         n[        R                  R                  U5      nU R	                  [
        5         UR                  UR                  R                  5       5        S S S 5        g ! , (       d  f       g = fN)	MockEnvironmentCrashInInitr   r   r   assertRaises	Exceptionr%   r&   r'   r   s      r   test_reraise_exception_in_init2ExternalProcessTest.test_reraise_exception_in_init2   sP    ,K
..
(
(
5C			9	%	hhs&&() 
&	%	%s   *A..
A<c                    [         R                  " [        SS9n[        R                  R                  U5      nUR                  5         UR                  UR                  R                  5       5        UR                  UR                  R                  5       5        U R                  [        5         UR                  UR                  R                  5       5        S S S 5        g ! , (       d  f       g = f)Nr   )crash_at_step)r   r   MockEnvironmentCrashInStepr   r   r   r$   r%   r&   r'   r-   r.   r   s      r   test_reraise_exception_in_step2ExternalProcessTest.test_reraise_exception_in_step8   s    ##$>aPK
..
(
(
5CIIKHHS$$&'HHS$$&'			9	%	hhs&&() 
&	%	%s   0*C##
C1 N)	__name__
__module____qualname____firstlineno__r   r(   r/   r4   __static_attributes__r6   r!   r   r   r      s    
**r!   r   c                       \ rS rSrSrS rSrg)r,   B   z!Raise an error when instantiated.c                     [        5       er+   )RuntimeError)r   unused_argsunused_kwargss      r   __init__#MockEnvironmentCrashInInit.__init__E   s
    
.r!   r6   N)r7   r8   r9   r:   __doc__rB   r;   r6   r!   r   r,   r,   B   s
    )r!   r,   c                   8   ^  \ rS rSrSrU 4S jrU 4S jrSrU =r$ )r3   I   z=Raise an error after specified number of steps in an episode.c                 F   > [         [        U ]  SSUS-   US-   S9  Xl        g )Nr   r      r   )superr3   rB   _crash_at_step)r   r2   	__class__s     r   rB   #MockEnvironmentCrashInStep.__init__L   s8    	
$d4&BFBORSBSBORSBS 5 U (r!   c                 ~   > [         [        U ]
  " U0 UD6nU R                  S   U R                  :X  a
  [        5       eU$ )N)rI   r3   r%   stepsrJ   r?   )r   argskwargs
transitionrK   s       r   r%   MockEnvironmentCrashInStep.stepS   s>    14=tNvNJzz"~,,,Nr!   )rJ   )	r7   r8   r9   r:   rD   rB   r%   r;   __classcell__)rK   s   @r   r3   r3   I   s    E( r!   r3   __main__)rD   
__future__r   r   r   r   tf.compat.v1compatv1tfagentsr   testTestCaser   objectr,   r   r3   r7   mainr6   r!   r   <module>r`      sp    & &  %    $*"''** $*N !6!6 " z'',,. r!   