def test_pdf_return_types(transition: Transition): df, w = data(20) transition.fit(df, w) single = transition.pdf(df.iloc[0]) multiple = transition.pdf(df) assert isinstance(single, float) assert multiple.shape == (20,)
def test_argument_order(transition: Transition): """ Dataframes passed to the transition kernels are generated from dicts. Order of parameter names is no guaranteed. The Transition kernel has to take care of the correct sorting. """ df, w = data(20) transition.fit(df, w) test = df.iloc[0] reversed = test[::-1] # works b/c of even nr of parameters assert (np.array(test) != np.array(reversed)).all() assert transition.pdf(test) == transition.pdf(reversed)