
    pjX	                    f    d dl mZ d dlZd dlmc mZ d dlm	Z	mZ d dl
mZ d Zd Zd Zd Zd	 ZdS )
    )annotationsN)UTCdatetime)assess_freshnessc            
        t          ddt          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}}| 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}}| 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 )NTz
2026-07-30        tzinfomarket	availableas_ofnowsource_kindfresh==z.%(py2)s
{%(py2)s = %(py0)s.status
} == %(py5)sresultpy0py2py5assert %(py7)spy7z
2026-07-31z6%(py2)s
{%(py2)s = %(py0)s.expected_as_of
} == %(py5)swithin_market_session_lagz3%(py2)s
{%(py2)s = %(py0)s.reason_code
} == %(py5)s)r   r   r   status
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationexpected_as_ofreason_coder   @py_assert1@py_assert4@py_assert3@py_format6@py_format8s         ]/home/agent/.hermes/worktrees/FinanceManager-sprint20d/tests/unit/test_freshness_policy_v1.pyGtest_market_freshness_counts_trading_sessions_not_weekend_calendar_daysr3      s   T1a,,,	  F =#G#=G##########=G############6#####6######=####G########################### 0L0 L0000000000 L0000000000006000006000000 0000L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<!<<!<<<<<<<<<<<!<<<<<<<<<<<<<6<<<<<6<<<<<<<<<<!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<    c            
     \   t          ddt          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}}| 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 )NTz
2026-04-02r         r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r,   s         r2   'test_market_freshness_uses_six_holidaysr8      s   T1a,,,	  F =#G#=G##########=G############6#####6######=####G########################### 0L0 L0000000000 L0000000000006000006000000 0000L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0r4   c            
     \   t          ddt          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}}| 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 )NTz2026-07-30T00:00:00Zr   r	   r
   r   crypto_24_7r   staler   r   r   r   r   r   crypto_update_overduer    r   r   r   r!   r"   r#   r$   r%   r&   r'   r(   r)   r+   r,   s         r2   ?test_crypto_freshness_remains_24_7_and_does_not_ignore_weekendsr>   !   s   $T1a,,,!	  F =#G#=G##########=G############6#####6######=####G###########################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888888r4   c            
        t          ddt          dddt                    d          } t          ddt          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}}| 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}}|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}}|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 )NTz
2026-07-27r   r	   r
   r   bank_balancer   managed_portfolior   r   r   bankr   r   r   within_bank_update_rhythmr    managedwithin_managed_update_rhythmr=   )rB   rD   r-   r.   r/   r0   r1   s          r2   ?test_bank_and_managed_portfolio_follow_canonical_update_rhythmsrF   -   s   T1a,,,"	  D T1a,,,'	  G ;!'!;'!!!!!!!!!!;'!!!!!!!!!!!!4!!!!!4!!!!!!;!!!!'!!!!!!!!!!!!!!!!!!!!!!!!!!!:::::::::::::::::::::::::::4:::::4::::::::::::::::::::::::::::::::::::::>$W$>W$$$$$$$$$$>W$$$$$$$$$$$$7$$$$$7$$$$$$>$$$$W$$$$$$$$$$$$$$$$$$$$$$$$$$$@"@@"@@@@@@@@@@@"@@@@@@@@@@@@@7@@@@@7@@@@@@@@@@"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@r4   c            
        t          dd t          dddt                    d          } t          dd t          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}}| 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}}|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}}|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 )NFr   r	   r
   r   r@   r   Tunavailabler   r   r   r   r   value_unavailabler    unknownbusiness_date_missingr=   )rH   rJ   r-   r.   r/   r0   r1   s          r2   9test_missing_value_and_missing_business_date_are_distinctrL   A   s   "T1a,,,"	  K T1a,,,"	  G ........................;.....;....................................."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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99999999999999>&Y&>Y&&&&&&&&&&>Y&&&&&&&&&&&&7&&&&&7&&&&&&>&&&&Y&&&&&&&&&&&&&&&&&&&&&&&&&&&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97999997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999999999999r4   )
__future__r   builtinsr$   _pytest.assertion.rewrite	assertionrewriter"   r   r    jarvis_finance.quality.freshnessr   r3   r8   r>   rF   rL    r4   r2   <module>rT      s    " " " " " "               " " " " " " " " = = = = = =
= 
= 
=	1 	1 	1	9 	9 	9A A A(: : : : :r4   