a a_@sdZddlZddlmmZddlZddl Z ddl m Z m Z ddl mZddZejdejjdd d jejd Ze jjd d Ze jjddZdS)zTest methods for faster fishersN)exactexact_with_odds_ratios)statscCs tjddgtjd}tjddgtjd}tjddgtjd}tjddgtjd}t||||d}tj|td d gt||||d }tj|td d gt||||d}tj|tdd gt||||d }tj|dtddgtj|d|dS)z0Test the exact method with numpy arrays as inputZdtype2ZlessgF]kSU?g=Զ?greaterg?g 4yT?z two-sidedg?rg@g@N)nparrayuint64rZtestingZassert_array_almost_equalr)Za_valuesZb_valuesZc_valuesZd_valuesZlessesZgreatersZ two_tailsZ odds_greatersr4/home/max/code_repo/faster_fishers/tests/test_ext.py test_exactsr*i)i'r )sizercCsF|ttdddftdddftdddftdddfd}dS)zBenchmark faster fisher.Nrrrrr )rvalues) benchmark_rrrtest_benchmark_faster_fischer!srcCs^tddd}t|}||tdddftdddftdddftdddfd }dS) zBenchmark scipy fisher.)returncSs"tj||g||gg|d\}}|S)z#Return scipy's fisher's exact test.) alternative)rZ fisher_exact)abcdrZ odds_ratioZp_valuerrrscipy_p_values*sz,test_benchmark_scipy..scipy_p_valuesNrrrrr )floatr Z vectorizer)rrfunctionrrrrtest_benchmark_scipy's r")__doc__builtins @py_builtins_pytest.assertion.rewrite assertionrewrite @pytest_arnumpyr pytestfaster_fishersrrZscipyrrrandomseedrandintZastyperrmarkrrr"rrrrs"