+
    ,Qja  c                       R t ^ RIt^ RIHu Ht ^ RIt^ RIt ! R R4      t	R t
R tR tR tR tR	 tR
 tR tR tR tR tR# )u   Proactive phone events handled in main.Session: new-location debounce +
prompt, geofence→place routines, and SMS watch-list gating. No network — the
phone store is stubbed and _deliver_proactive is captured.Nc                   2   a  ] tR t^t o R tR tR tRtV tR# )FakeWSc                    . V n         R # Nsent)selfs   &G/Users/ahmed/devFolder/Ultron/claude-voice/gateway/tests/test_events.py__init__FakeWS.__init__	   s	    	    c                D   "   V P                   P                  V4       R # 5ir   )r   append)r   frames   &&r   	send_jsonFakeWS.send_json   s     		s    c                   "   R # 5ir    )r   datas   &&r   
send_bytesFakeWS.send_bytes   s     s   r   N)	__name__
__module____qualname____firstlineno__r	   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s       r   r   c                    a \         P                  ! \        4       R 7      pRVn        . oV3R lpV P	                  VRV4       VS3# )wschatc                 2   <"   SP                  V 4       R # 5ir   r   )injected	delivereds   &r   rec_session.<locals>.rec   s     "s   _deliver_proactive)mainSessionr   modesetattr)monkeypatchsessr%   r$   s   &  @r   _sessionr.      sA    <<68$DDII#2C8?r   c                 V   a V3R  lpV P                  \        P                  RV4       R# )c                 B   <"   \        SP                  V . 4      4      # 5ir   )listget)kindmappings   &r   	fake_list_wire_store.<locals>.fake_list   s     GKKb)**s   
list_itemsN)r+   r(   phone_store)r,   r4   r5   s   &f r   _wire_storer9      s     +((,	Br   c                     \         P                  ! \        4       R 7      p V P                  pRpRq1! W#4      pRqTVJ qf'       Eg	   \        P
                  ! RV3RWE34      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      R	\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;p;reRR\        R4      P                  4       3V n        V P                  pRpRq1! W#4      pRqTVJ qf'       Eg	   \        P
                  ! RV3RWE34      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      R	\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;p;reV P                  pRpRq1! W#4      pRqTVJ qf'       Eg	   \        P
                  ! RV3RWE34      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      R	\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;p;reR# )r   L:@皙I@Tpy0r-   py2py4py6py8py11zassert %(py13)spy13NtimegytL:@go|I@Fg     :@g     @I@)is)zg%(py8)s
{%(py8)s = %(py2)s
{%(py2)s = %(py0)s._should_prompt_location
}(%(py4)s, %(py6)s)
} is %(py11)s)r(   r)   r   _should_prompt_location
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanation
__import__	monotonic_last_loc_prompt)	r-   @py_assert1@py_assert3@py_assert5@py_assert7@py_assert10@py_assert9@py_format12@py_format14s	            r   $test_should_prompt_location_debouncerZ   %   s?   <<68$D''==u='5=======5======4====4==='======u===5============"E:f+=+G+G+IJD''DD(D';DuDuDDDDD;DDDDDD4DDDD4DDD'DDDDDD(DDD;DDDuDDDDDDDDD''==u='5=======5======4====4==='======u===5============r   c                   "   \        V 4      w  r\        V / 4       VP                  R RRRRRRRR//4      G R	j  xL
  \        V4      p^qCV8H  qU'       Eg   \        P
                  ! RV3RW43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      /,          pRRV/,          p\        \        P                  ! V4      4      hR	;p;rT. pRq2^ ,          qCV9   qUq'       d   Rq^ ,          qV9   qp	V	'       Eg$   \        P
                  ! RV3RW434      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          qxP                  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
;rR	#  EL5i) typeeventr3   new_locationcoordslatr;   lngr<   Nr=   lenpy1r$   py3r@   assert %(py8)srA   z26.30
save_place%(py8)srB   py14%(py16)spy16assert %(py19)spy19==z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sinz%(py3)s in %(py6)sz%(py11)s in %(py14)s)r.   r9   _handle_eventrb   rG   rH   rI   rJ   rK   rL   rM   rN   r   _format_boolopr,   r-   r$   @py_assert2rT   @py_assert4@py_format7@py_format9rR   @py_assert0rV   @py_assert13@py_assert12@py_format15@py_format17@py_format18@py_format20s   &                r   !test_new_location_unknown_promptsr   0   s    {+ODR 


fgv~&ue(DF G G Gy>QQ>33yy>QC7ClCl"CC|C|C|'CCCCC7CCC7CCClCCCCCCCCC||CCC|CCC|CCCCCCCCCCCCCCCCGs%   8K KA1K -AK ?B)K )D5K c                 <  "   \        V 4      w  r\        V / 4       R RRRRRRRR//pVP                  V4      G R	j  xL
  VP                  V4      G R	j  xL
  \        V4      p^qTV8H  qf'       Eg   \        P
                  ! RV3RWE3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      /,          pRRV/,          p\        \        P                  ! V4      4      hR	;p;reR	#  ELZ ELD5i)r\   r]   r3   r^   r_   r`   r;   ra   r<   Nr=   rb   rc   r$   rd   r@   re   rA   rm   ro   )r.   r9   rt   rb   rG   rH   rI   rJ   rK   rL   rM   rN   )	r,   r-   r$   evtrw   rT   rx   ry   rz   s	   &        r   'test_new_location_debounced_second_timer   9   s     {+ODR 7FNeUE513C


S
!!!


S
!!!y>QQ>33yy>Q "!s0   :FFFFA1FAFA=FFc                 8  "   \        V 4      w  r\        V \        P                  R RRRRR/./4       VP	                  RRRR	R
RRRR//4      G Rj  xL
  . q2V8H  qD'       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;rCR#  L5i)labelhomer`   r;   ra   r<   r\   r]   r3   r^   r_   g0*L:@gK=I@Nr=   r$   rd   assert %(py5)spy5rm   z%(py0)s == %(py3)s)r.   r9   r8   
KIND_PLACErt   rG   rH   rI   rJ   rK   rL   rM   rN   r,   r-   r$   rw   rR   @py_format4@py_format6s   &      r   (test_new_location_near_known_place_skipsr   C   s     {+ODk44	&%%97; < =


fgv~&%(JL M M M?999Ms   ADDA!D4A%Dc                   a"   \        V 4      w  r. oV3R  lpV P                  \        RV4       \        V \        P
                  RRRRRRR/RRR	R
R//RRRRRRR/RRRRR//./4       VP                  RRRRRRRRR/RR/4      G Rj  xL
  R.pSV8H  qU'       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;rTR#  L5i)#c                 @   <"   SP                  V R ,          4       R# 5i)nameNr"   )routinefireds   &r   	fake_fire5test_geofence_place_fires_routines.<locals>.fake_fireP   s     WV_%s   fire_routiner   z	at officetriggerr\   placeofficeactionspeak_briefbrieftasks	unrelatedrD   atz07:00say_texttextxr]   r3   r^   r_   r`   r;   ra   r<   Nr=   r   rd   r   r   rm   r   )r.   r+   r(   r9   r8   KIND_ROUTINErt   rG   rH   rI   rJ   rK   rL   rM   rN   )	r,   r-   
_deliveredr   rw   rR   r   r   r   s	   &       @r   "test_geofence_place_fires_routinesr   L   s:    ,DE&ni8k66	i&'7H)M	FM7G<	>	i&&$)H	FJ4	69   

fgv~&eT(B%x1 2 2 2 !M!5M!!!!!5M!!!!!!5!!!!5!!!M!!!!!!!!2s   BE
EA$E0A%Ec                   "   \        V 4      w  r\        V \        P                  R R/./4       VP	                  RRR RRRR^/4      G Rj  xL
  \        V4      p^qCV8H  qU'       Eg   \        P                  ! RV3RW43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      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;rT. pRq2^ ,          qCV9   qUq'       d   Rq^ ,          qV9   qp	V	'       Eg$   \        P                  ! RV3RW434      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          qxP                  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
;rR#  EL5i)senderSNBr\   sms_inz
SNB-AlAhlibodyzYour OTP is 123456tsNr=   rb   rc   r$   rd   r@   re   rA   123456rg   rB   rh   ri   rj   rk   rl   rm   ro   rp   rr   rs   )r.   r9   r8   KIND_SMS_WATCH_handle_smsrb   rG   rH   rI   rJ   rK   rL   rM   rN   r   ru   rv   s   &                r    test_sms_watched_sender_deliversr   `   s    {+ODk88He;L:MNO


FHh"$8$C D D Dy>QQ>33yy>QD<DQ<D<'DDHD!D,DDDDD<DDD<DDD<DDDDDDDDDHDDDHDDDDDDDDDDDDDDDDDDDDs(   A	K1K.A1K1>AK1B)K1:D5K1c           
      ,  "   \        V 4      w  r\        V \        P                  R R/./4       VP	                  RRR RRRR^/4      G Rj  xL
  . q2V8H  qD'       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;rCR#  L5i)r   Barqr\   r   SomeBankr   hellor   Nr=   r$   rd   r   r   rm   r   )r.   r9   r8   r   r   rG   rH   rI   rJ   rK   rL   rM   rN   r   s   &      r   !test_sms_unwatched_sender_ignoredr   i   s     {+ODk88Hf;M:NOP


FHh
"GT16 7 7 7?9997s   A	DDA!D.A%Dc                 "  "   \        V 4      w  r\        V \        P                  R R/./4       VP	                  RRR RRRR^/4      G Rj  xL
  \        V4      p^qCV8H  qU'       Eg   \        P                  ! RV3RW43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      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;rTR#  ELA5i)r   *r\   r   Anyoner   hir   Nr=   rb   rc   r$   rd   r@   re   rA   rm   ro   )r.   r9   r8   r   r   rb   rG   rH   rI   rJ   rK   rL   rM   rN   )r,   r-   r$   rw   rT   rx   ry   rz   s   &       r   test_sms_wildcard_deliversr   q   s     {+ODk88Hc?:KLM


FHh"D$3 4 4 4y>QQ>33yy>Q4s!   A	FFA1F>AFA=Fc                  n    \         P                  ! \        4       R 7      p V P                  RRRR/4       R# )r   idnopeokTN)r(   r)   r   _resolve_action)r-   s    r   &test_resolve_action_unknown_id_is_safer   y   s)    <<68$D$d34r   )__doc__builtinsrI   _pytest.assertion.rewrite	assertionrewriterG   r(   r8   r   r.   r9   rZ   r   r   r   r   r   r   r   r   r   r   r   <module>r      sZ   >    C>D"(E5r   