
    {:&j                     >    d dl Zd dlmc mZ d dlmZ d Zd Z	d Z
dS )    N)evaluate_live_preview_preflightc                  *   t          i           } | 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	D ]}| j
        }||v }|st          j        d
|fd||f          dt	          j                    v st          j        |          rt          j        |          nd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}}| j        }|j        }d}	 ||	          }
|
sddt	          j                    v st          j        |           rt          j        |           ndt          j        |          t          j        |          t          j        |	          t          j        |
          dz  }t          t          j	        |                    d x}x}x}	}
d S )N)evidenceFAIL==z.%(py2)s
{%(py2)s = %(py0)s.status
} == %(py5)srpy0py2py5assert %(py7)spy7)tests_greencompileall_greenmainnet_readonly_reconciletestnet_alo_canceltestnet_schedule_canceltestnet_fill_stopdata_quality_gateapi_health_handledv76_net_scorecard_gatesnonce_managertelegram_alerts_testedlegacy_autotrader_blockedin)z4%(py0)s in %(py4)s
{%(py4)s = %(py2)s.failed_gates
}gate)r   r   py4zassert %(py6)spy6BLOCKzpassert %(py8)s
{%(py8)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.recommendation
}.startswith
}(%(py6)s)
})r   r   r    r!   py8)r   status
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationfailed_gatesrecommendation
startswith)r
   @py_assert1@py_assert4@py_assert3@py_format6@py_format8r   @py_format5@py_format7@py_assert5@py_assert7@py_format9s               W/home/agent/projects/CryptoTradingBot/Crypto_Agent/tests/test_preflight_live_preview.py>test_preflight_blocks_missing_required_evidence_and_live_flagsr;      s   '444A8v8v8v118v f & &~%t~%%%%%%%%%%t~%%%%%%%%%%%%t%%%%%t%%%%%%%%%%%%%q%%%%%q%%%%%%~%%%%%%%%%%%%%%%%%%%%%%%%%%/&/w/&&w///////////////1/////1//////////&////w//////////////////////////////    c                    |                      dd           |                      dd           d dD             }t          |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_LIVE_TRADING_ALLOWEDtrueCTB_LIVE_CONFIRMATIONtokenc                     i | ]}|d S T .0ks     r:   
<dictcomp>zRtest_preflight_pass_is_only_permission_to_request_sir_approval.<locals>.<dictcomp>   s,      r  r  rA4  r  r  rr<   )r   r   r   r   r   r    position_without_stop_impossibler   r   r   r   r   secrets_scan_cleanr   r   expected_confirmationPASSr   r	   r
   r   r   r   zSir may approver   )z6%(py1)s in %(py5)s
{%(py5)s = %(py3)s.recommendation
}py1py3r   )setenvr   r$   r%   r&   r'   r(   r)   r*   r+   r,   r.   
monkeypatchr   r
   r0   r1   r2   r3   r4   @py_assert0@py_assert2s
             r:   >test_preflight_pass_is_only_permission_to_request_sir_approvalrV      s0   16:::.888 r  r  "q  r  r  rH'QXYYYA8v8v8v118v0 00 00000000000 0000000000000000000000000000 000000000000000000000000000000r<   c                 $   |                      dd           |                      dd           d dD             }d|d<   t          |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}	}|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 S )Nr>   r?   r@   rA   c                     i | ]}|d S rC   rD   rE   s     r:   rH   zUtest_preflight_treats_schedule_cancel_volume_limit_as_conditional.<locals>.<dictcomp>   s,      #j  #j  #jq1d  #j  #j  #jr<   )r   r   r   r   r   rI   r   r   r   r   r   rJ   r   4conditional_unavailable_due_to_exchange_volume_limitr   rK   $PASS_WITH_CONDITIONAL_SCHEDULECANCELr   r	   r
   r   r   r   )not in)z8%(py1)s not in %(py5)s
{%(py5)s = %(py3)s.failed_gates
}rN   )r   )z9%(py2)s
{%(py2)s = %(py0)s.conditional_gates
} == %(py5)s)rQ   r   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   conditional_gatesrR   s
             r:   Atest_preflight_treats_schedule_cancel_volume_limit_as_conditionalr]      s    16:::.888 #j  #j  5i  #j  #j  #jH*`H&''QXYYYA8===8===========8=============1=====1======8================================$:AN:$N::::::::::$N:::::$:::::::::::A:::::A::::::N:::::::::::::::::::::::::::>">>">>>>>>>>>>>">>>>>>>>>>>>>1>>>>>1>>>>>>>>>>">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>r<   )builtinsr'   _pytest.assertion.rewrite	assertionrewriter%   src.tools.preflightr   r;   rV   r]   rD   r<   r:   <module>rc      si                  ? ? ? ? ? ?0 0 01 1 1? ? ? ? ?r<   