U
vi @ s d dl mZmZmZmZmZmZmZ d dlZd dlm Z m
Z
m Z d dlmZ d dl
mZ d dlmZ ddlmZ dd lmZ dd
lmZ ddlmZ edZG d
d deZdS ) )AnyCallableListOptionalTypeVarUnioncastN)
Observableabctyping)
Disposable)VirtualTimeScheduler)Recorded )ColdObservable)
HotObservableMockObserver)ReactiveTest_Tc s e Zd ZdZdZdejeje ee j
d fdd
Zdee
g ee f ee ee ee ee d fdd
Zeee eee f ee d
ddZeee eee f ee d
d
dZee dddZ ZS )
TestSchedulerzTest time scheduler used for testing applications and libraries
built using Reactive Extensions. All time, both absolute and relative is
specified as integer ticksFN)duetimeactionstatereturnc s( t |tr|n| |}t |||S )a Schedules an action to be executed at the specified virtual
time.
Args:
duetime: Absolute virtual time at which to execute the
action.
action: Action to be executed.
state: State passed to the action to be executed.
Returns:
Disposable object used to cancel the scheduled action
(best effort).
)
isinstancefloatZ
to_secondssuperschedule_absolute)selfr r r __class__ P/opt/alt/python38/lib/python3.8/site-packages/reactivex/testing/testscheduler.pyr s zTestScheduler.schedule_absolute)createcreated
subscribeddisposedr c s |pt j}|pt j}|pt j}| ddd tjttjd fdd
}| || d
tjttjdfdd
}| || dtjttjdfdd
}| || t
S )a$ Starts the test scheduler and uses the specified virtual
times to invoke the factory function, subscribe to the
resulting sequence, and dispose the subscription.
Args:
create: Factory method to create an observable sequence.
created: Virtual time at which to invoke the factory to
create an observable sequence.
subscribed: Virtual time at which to subscribe to the
created observable sequence.
disposed: Virtual time at which to dispose the
subscription.
Returns:
Observer with timestamped recordings of notification
messages that were received during the virtual time window
when the subscription to the source sequence was active.
N) schedulerr r c s dk r nt t S )z&Called at create time. Defaults to 100N) reactivexneverr r( r )r$ sourcer" r#
action_createR s z*TestScheduler.start.