+
    ,Qj  c                       R t ^ RIt^ RIHu Ht ^ RIt^ RIt^ RI	t	^ RI
t
R tR tR t ! R R4      t ! R R4      tR	 tR
 t ! R R4      tR tR tR tR# )u   Routine scheduler: cron parsing, reload → jobs, and fire_routine dispatch to
a connected session (or the no-session log path). APScheduler's real CronTrigger
is used (offline), but the scheduler backend is a FakeSched so no loop/timers.Nc                     \         P                  ! R RRR/4      p R^R^ RR/qV8H  q"'       g   \        P                  ! RV3RW34      RR	\        P
                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;r!R# )typetimeat07:00hourminuteday_of_weekNpy0cpy3assert %(py5)spy5==z%(py0)s == %(py3)s
	scheduler
parse_cron
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanation)r
   @py_assert2@py_assert1@py_format4@py_format6s        J/Users/ahmed/devFolder/Ultron/claude-voice/gateway/tests/test_scheduler.pytest_parse_cron_dailyr!      s    ffdG<=AHa========1======1====1============    c            
      2   \         P                  ! R RRRRRR.RR/4      p . qR	,          p^q2V8H  qDqT'       d   V R
,          p^qvV8H  qpV'       Eg$   \        P                  ! RV3RW#34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          qP                  V
4       V'       dk   \        P                  ! RX3RXX34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          qP                  V4       \        P                  ! V^ 4      / ,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;p;p;p;rV R,          pRqV8H  q"'       gy   \        P                  ! RV3RW_34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p	\        \        P                  ! V	4      4      hR;p;r/R# )r   bothr   z18:30daysMon	wednesdayplaceofficer   r   r   py6z%(py8)spy8py11py14z%(py16)spy16zassert %(py19)spy19Nr   zmon,wedpy1py4assert %(py6)sr   )z%(py3)s == %(py6)s)z%(py11)s == %(py14)sz%(py1)s == %(py4)s)	r   r   r   r   r   append_format_boolopr   r   )r
   r   r   @py_assert5@py_assert4@py_assert0@py_assert10@py_assert13@py_assert12@py_format7@py_format9@py_format15@py_format17@py_format18@py_format20@py_assert3@py_format5s                    r    test_parse_cron_specific_daysrD      s7   ffdG$uk&:GXO 	PA0V900?00q{0b0b0000090009000000000000{b000{000b0000000000000000](y(y(((((((((((y((((((((r"   c                  ^	   \         P                  p R RRR/q! V4      pRq2VJ qD'       g   \        P                  ! RV3RW#34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p ;p;p;rC\         P                  p R RRR/q! V4      pRq2VJ qD'       g   \        P                  ! RV3RW#34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p ;p;p;rC\         P                  p R RRR/q! V4      pRq2VJ qD'       g   \        P                  ! RV3RW#34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p ;p;p;rC\         P                  p / q! V4      pRq2VJ qD'       g   \        P                  ! RV3RW#34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p ;p;p;rCR# )r   r(   gymNr	   r   py2r1   r*   py9zassert %(py11)sr,   r   r   nopez25:00)is)zP%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse_cron
}(%(py4)s)
} is %(py9)sr   )r   rB   r6   @py_assert8@py_assert7@py_format10@py_format12s          r    /test_parse_cron_rejects_place_only_and_bad_timerO      s   J'5 AJ ABJdJdJJJJJBJJJJJJ9JJJJ9JJJJJJ AJJJBJJJdJJJJJJJJGv >G >?G4G4GGGGG?GGGGGG9GGGG9GGGGGG >GGG?GGG4GGGGGGGGHw ?H ?@HDHDHHHHH@HHHHHH9HHHH9HHHHHH ?HHH@HHHDHHHHHHHH++#+t+t+++++#++++++9++++9+++++++++#+++t+++++++++r"   c                   ,   a  ] tR t^t o R tR tRtV tR# )FakeJobc                    W n         Wn        R # N)id_store)selfstorejids   &&&r    __init__FakeJob.__init__    s    r"   c                p    V P                    Uu. uF  qV Jg   K
  VNK  	  upV P                   R &   R# u upi ):NNNN)rU   )rV   js   & r    removeFakeJob.remove$   s+    %)[[B[TM!![BABs   33)rU   rT   N)__name__
__module____qualname____firstlineno__rY   r]   __static_attributes____classdictcell____classdict__s   @r    rQ   rQ      s     C Cr"   rQ   c                   F   a  ] tR t^(t o R tR tR tRR ltR	R ltRt	V t
R# )
	FakeSchedc                "    . V n         R V n        R# FNjobsrunningrV   s   &r    rY   FakeSched.__init__)   s    	r"   c                    R V n         R# )TNrm   rn   s   &r    startFakeSched.start-   s	    r"   c                ,    \        V P                  4      # rS   )listrl   rn   s   &r    get_jobsFakeSched.get_jobs0   s    DIIr"   Nc                h    \        V P                  V4      pV P                  P                  V4       V# rS   )rQ   rl   r4   )rV   functriggerargsrT   kwjobs   &&&&&, r    add_jobFakeSched.add_job3   s)    dii$		
r"   c                    R V n         R# rj   rq   )rV   waits   &&r    shutdownFakeSched.shutdown8   s	    r"   rk   )NNN)F)r_   r`   ra   rb   rY   rr   rv   r~   r   rc   rd   re   s   @r    rh   rh   (   s#     
 r"   rh   c                  :	  a"   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R//R RRRRRR/RRRRR	//.oV3R lp \        4       p\        P                  ! RWR7      pVP                  4       G Rj  xL
 p^qCV8H  qU'       g   \        P
                  ! R%V3R&W434      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;rTVP                  p\        V4      p^qV	8H  q'       Eg3   \        P
                  ! R%V
3R'W34      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V	4      /,          pR R!V/,          p\        \        P                  ! V4      4      hR;p;p;rVP                  4       G Rj  xL
 p^qV8H  qD'       gy   \        P
                  ! R%V3R(W34      R\        P                  ! V4      R"\        P                  ! V4      /,          pR#R$V/,          p\        \        P                  ! V4      4      hR;p;rNVP                  p\        V4      p^qV	8H  q'       Eg3   \        P
                  ! R%V
3R'W34      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V	4      /,          pR R!V/,          p\        \        P                  ! V4      4      hR;p;p;rR#  EL% EL5i))namebriefrz   r   r   r   r   actionspeak_brieftaskseveningr$   z20:00r(   homesay_texttexthiatworkr)   c                     <"   S # 5irS    )routiness   r    list_routines?test_reload_schedules_only_time_routines.<locals>.list_routinesG   s     s   Ndispatchr   schedr	   nr   r   r   lenr0   faker+   zassert %(py10)spy10r1   r2   r*   r   r   )zJ%(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.jobs
})
} == %(py8)sr3   )rh   r   RoutineSchedulerrr   r   r   r   r   r   r   r   r   rl   r   reload)r   r   r   r   r   r   r   r   r7   rL   @py_assert6r=   @py_format11r8   rB   rC   r<   r   s                    @r    (test_reload_schedules_only_time_routinesr   <   s    	)ffdG%D	FM7G<	>	Ig(/(9	FJ5	7 
9vw&J	FM7G<	>H ;D&&5BPEkkmAM6MMMM1MMMMMM1MMMM1MMMMMMMMMMMyy3y>QQ>33tty>Q$1$1$$$$$$$$$$$1$$$$$$$$yy3y>QQ>33tty>Q 	  sI   A-R0R1A!RCR/ARB%R&R'DR/ARBRRc            	      l  "   R  p \        4       p\        P                  ! RV VR7      pVP                  4       G Rj  xL
 p^ qCV8H  qU'       gy   \        P
                  ! RV3RW434      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;rTVP                  p. qV	8H  qD'       g   \        P
                  ! RV3RW34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR	\        P                  ! V4      R
\        P                  ! V	4      /,          p
RRV
/,          p\        \        P                  ! V4      4      hR;p;rIR#  ELu5i)c                      "   \        R 4      h5i)zmemory down)RuntimeErrorr   r"   r    boom0test_reload_survives_storage_error.<locals>.boomV   s     =))s   Nr   r0   r1   r2   r*   r	   r   rG   r   zassert %(py7)spy7r   r3   )z,%(py2)s
{%(py2)s = %(py0)s.jobs
} == %(py5)s)rh   r   r   rr   r   r   r   r   r   rl   r   r   r   )r   r   r   r8   rB   r   rC   r<   r   r7   r   @py_format8s               r    "test_reload_survives_storage_errorr   U   s     *;D&&D-13E#!#!###########!########99?9449 s   :F4F1C7F45A=F4c                   ,   a  ] tR t^`t o R tR tRtV tR# )FakeSessionc                     Wn         . V n        R # rS   )user	delivered)rV   r   s   &&r    rY   FakeSession.__init__a   s    	r"   c                D   "   V P                   P                  V4       R # 5irS   )r   r4   )rV   injecteds   &&r    _deliver_proactiveFakeSession._deliver_proactivee   s     h's    )r   r   N)r_   r`   ra   rb   rY   r   rc   rd   re   s   @r    r   r   `   s     ( (r"   r   c                 l  "   R  pV P                  \        P                  RV4       \        P                  ! 4       p\	        V4      p\        P
                  ! V4        \        P                  ! RRRRRRR/R	RR
RR//4      G Rj  xL
  \        P                  ! V4       VP                  qD'       g   \        P                  ! R4      R,           RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          p\        \        P                   ! V4      4      hRpRqcP                  ^ ,          qvV9   q'       gy   \        P"                  ! RV3RWg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                   ! V
4      4      hR;p;rRqcP                  ^ ,          qvV9   q'       gy   \        P"                  ! RV3RWg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                   ! V
4      4      hR;p;rR#  EL  \        P                  ! T4       i ; i5i)c                    "   R # 5i)z- Call the supplierr   )_argss   &r    
fake_tasksAtest_fire_routine_speaks_to_connected_session.<locals>.fake_tasksj   s     $   _tasks_listr   zmorning briefrz   r   r   r   r   r   r   r   r   Nz*a connected session must receive the briefz/
>assert %(py2)s
{%(py2)s = %(py0)s.delivered
}r	   sessrG   zCall the supplierr0   r1   r2   r*   )in)z%(py1)s in %(py4)s)setattrmaintools_groupr   register_sessionfire_routineunregister_sessionr   r   _format_assertmsgr   r   r   r   r   r   r   )monkeypatchr   r   r   r   @py_format3r8   rB   r   rC   r<   s   &          r    -test_fire_routine_speaks_to_connected_sessionr   i   s    %

M:><<>DtD$&Og6v}gw?!A B 	B 	B
 	%>>G>GGGGGGGGGG4GGGG4GGG>GGGGGG3.."33"333333333333"333333333/nnQ////////?///?////////////	B
 	%s8   AJ4'J JJ 
A;J4FJ4J J11J4c                 j   "   \         P                  ! R RRRRRR/RRRR	R
//4      G Rj  xL
  R#  L5i)r   orphanrz   r   r   r   r   r   r   r   helloN)r   r   )caplogs   &r    &test_fire_routine_no_session_just_logsr   }   sB     


)ffdG%D6:vw79 : : :s   (313c                   a	a
"   . o	R  p\        4       p\        P                  ! RWR7      pVP                  4       G Rj  xL
  V\        n        VP                  o
V	V
3R lpWCn        \        P                  ! 4       G Rj  xL
  ^.pS	V8H  qf'       g   \        P                  ! R	V3R
S	V34      RR\        P                  ! 4       9   g   \        P                  ! S	4      '       d   \        P                  ! S	4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;reR#  EL L5i)c                     "   . # 5irS   r   r   r"   r    r   3test_reschedule_hook_reloads.<locals>.list_routines   s
     	r   Nr   c                  P   <"   S P                  ^4       S! 4       G Rj  xL
 #  L5i)   N)r4   )calledorigs   r    spy)test_reschedule_hook_reloads.<locals>.spy   s     aV||s   &$&r	   r   r   r   r   r   r   )rh   r   r   rr   r   _SCHEDr   _rescheduler   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   s   &        @@r    test_reschedule_hook_reloadsr      s     F;D&&5BPE
++-DK<<D L



S6S=6S66S  s+   ;EE
 A E EA$E&A%EE)__doc__builtinsr   _pytest.assertion.rewrite	assertionrewriter   r   phone_storer   r   r!   rD   rO   rQ   rh   r   r   r   r   r   r   r   r"   r    <module>r      se   R     >
),C C (2( (0(:r"   