
    c%j@                         d dl Zd dlmc mZ d dlZd dlZd dl	Z	d dl
Z
d dlmZ  ee                                          j        d         Zd Zd Zd ZdS )    N)Path   c                     t           j                                        } |                     dd            t	          j        t          j        t          t          dz            gt          | ddd          }|j
        }d}||k    }|st          j        d|fd||f          d	t          j                    v st          j        |          rt          j        |          nd	t          j        |          t          j        |          d
z  }dd|iz  }t#          t          j        |                    d x}x}}d}|j        }||v }|st          j        d|fd||f          t          j        |          d	t          j                    v st          j        |          rt          j        |          nd	t          j        |          dz  }dd|iz  }t#          t          j        |                    d x}x}}d S )NCTB_ALLOW_LEGACY_AUTOTRADERzAutoTrader.pyT   cwdenvtextcapture_outputtimeout   ==z2%(py2)s
{%(py2)s = %(py0)s.returncode
} == %(py5)sresultpy0py2py5assert %(py7)spy7zHLegacy AutoTrader disabled; use src/tools/preflight.py and v76 executorsinz.%(py1)s in %(py5)s
{%(py5)s = %(py3)s.stdout
}py1py3r   osenvironcopypop
subprocessrunsys
executablestrROOT
returncode
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationstdout	r
   r   @py_assert1@py_assert4@py_assert3@py_format6@py_format8@py_assert0@py_assert2s	            N/home/agent/projects/CryptoTradingBot/Crypto_Agent/tests/test_legacy_guards.py,test_autotrader_script_is_blocked_by_defaultr=   
   s4   
*//

CGG)4000^	TO3445  F !!!!!!!!!!!!!!!!!!!!!!!!6!!!!!6!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!UfY_YffUYfffffffffffUYffffffUfffffffffffY_fffffY_ffffffYffffffffffffffffffffffffffffff    c                     t           j                                        } |                     dd            t	          j        t          j        t          t          dz            gt          | ddd          }|j
        }d}||k    }|st          j        d|fd||f          d	t          j                    v st          j        |          rt          j        |          nd	t          j        |          t          j        |          d
z  }dd|iz  }t#          t          j        |                    d x}x}}d}|j        }||v }|st          j        d|fd||f          t          j        |          d	t          j                    v st          j        |          rt          j        |          nd	t          j        |          dz  }dd|iz  }t#          t          j        |                    d x}x}}d S )Nr   z%AutoTrader_backup_2026-03-29_17-30.pyTr   r   r   r   r   r   r   r   r   zLegacy AutoTrader disabledr   r   r   r   r4   s	            r<   Ktest_backup_autotrader_does_not_initialize_exchange_on_import_without_guardr@      s.   
*//

CGG)4000^	T$KKLLM  F !!!!!!!!!!!!!!!!!!!!!!!!6!!!!!6!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'86=8'=8888888888'=88888'888888888886888886888888=88888888888888888888888888888r>   c                    |                      dd           |                      dd           t          j                            dt          dz            }t          j                            |          }|j        }d }||u}|st          j        d|fd||f          d	t          j
                    v st          j        |          rt          j        |          nd	t          j        |          t          j        |          d
z  }dd|iz  }t          t          j        |                    d x}x}}|j                            |           |                    g           }	|                                j        }
d}|	|k    }|st          j        d|fd|	|f          dt          j
                    v st          j        |	          rt          j        |	          ndt          j        |          dz  }dd|iz  }t          t          j        |                    d x}}d}||
v }|st          j        d|fd||
f          t          j        |          dt          j
                    v st          j        |
          rt          j        |
          nddz  }dd|iz  }t          t          j        |                    d x}}d S )NHL_API_PRIVATE_KEYdummyHL_WALLET_ADDRESS0x1234567890abcdefpanic_closezpanic_close.py)is not)z2%(py2)s
{%(py2)s = %(py0)s.loader
} is not %(py5)sspecr   r   r      r   )z%(py0)s == %(py3)scode)r   r   zassert %(py5)sr   zPANIC CLOSE blockiertr   )z%(py1)s in %(py3)sout)r   r   )setenv	importlibutilspec_from_file_locationr)   module_from_specloaderr+   r,   r-   r.   r/   r0   r1   r2   exec_modulemain
readouterrrK   )monkeypatchcapsysrH   moduler5   r6   r7   r8   r9   rJ   rK   r;   @py_format4r:   s                 r<   2test_panic_close_still_requires_exact_confirmationrY   *   s   +W555*,@AAA>11-HXAXYYD^,,T22F;"d";d"""""""""";d""""""""""""4"""""4"""""";""""d"""""""""""""""""""""""""""KF###;;r??D





!C41941441")"c))))))))))"c)))))")))))))))))c)))))c)))))))))))))))))))))))))))))r>   )builtinsr-   _pytest.assertion.rewrite	assertionrewriter+   importlib.utilrM   r    r$   r&   pathlibr   __file__resolveparentsr)   r=   r@   rY    r>   r<   <module>rd      s                      				     



      tH~~'*g g g 9 9 9 * * * * *r>   