1919PY27 = sys .version_info .major == 2
2020if PY27 : # pragma: no cover
2121 import mock
22- TOLERANCE = 15
22+ TIGHT_TOLERANCE = 15
23+ LOOSE_TOLERANCE = 18
2324else :
2425 from unittest import mock
25- TOLERANCE = 12
26+ TIGHT_TOLERANCE = 13
27+ LOOSE_TOLERANCE = 18
2628
2729
2830BASELINE_DIR = 'baseline_images/test_viz'
@@ -513,23 +515,23 @@ def test__fit_ci(plot_data, fitlogs, known_lo, known_hi):
513515 nptest .assert_allclose (yhat_hi , known_hi , rtol = 0.001 )
514516
515517
516- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
518+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
517519def test_probplot_prob (plot_data ):
518520 fig , ax = plt .subplots ()
519521 fig = viz .probplot (plot_data , ax = ax , problabel = 'Test xlabel' , datascale = 'log' )
520522 assert isinstance (fig , plt .Figure )
521523 return fig
522524
523525
524- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
526+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
525527def test_probplot_qq (plot_data ):
526528 fig , ax = plt .subplots ()
527529 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , datalabel = 'Test label' ,
528530 datascale = 'log' , scatter_kws = dict (color = 'r' ))
529531 return fig
530532
531533
532- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
534+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
533535@pytest .mark .skipif (stats is None , reason = "no scipy" )
534536def test_probplot_qq_dist (plot_data ):
535537 fig , ax = plt .subplots ()
@@ -539,7 +541,7 @@ def test_probplot_qq_dist(plot_data):
539541 return fig
540542
541543
542- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
544+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
543545def test_probplot_pp (plot_data ):
544546 fig , ax = plt .subplots ()
545547 scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -549,7 +551,7 @@ def test_probplot_pp(plot_data):
549551 return fig
550552
551553
552- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
554+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
553555def test_probplot_prob_bestfit (plot_data ):
554556 fig , ax = plt .subplots ()
555557 fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , bestfit = True ,
@@ -558,7 +560,7 @@ def test_probplot_prob_bestfit(plot_data):
558560 return fig
559561
560562
561- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
563+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
562564def test_probplot_qq_bestfit (plot_data ):
563565 fig , ax = plt .subplots ()
564566 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True ,
@@ -567,7 +569,7 @@ def test_probplot_qq_bestfit(plot_data):
567569 return fig
568570
569571
570- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
572+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
571573def test_probplot_pp_bestfit (plot_data ):
572574 fig , ax = plt .subplots ()
573575 scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -579,23 +581,23 @@ def test_probplot_pp_bestfit(plot_data):
579581 return fig
580582
581583
582- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
584+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
583585def test_probplot_prob_probax_y (plot_data ):
584586 fig , ax = plt .subplots ()
585587 fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , datascale = 'log' , probax = 'y' )
586588 assert isinstance (fig , plt .Figure )
587589 return fig
588590
589591
590- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
592+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
591593def test_probplot_qq_probax_y (plot_data ):
592594 fig , ax = plt .subplots ()
593595 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , problabel = 'Test label' , probax = 'y' ,
594596 datascale = 'log' , scatter_kws = dict (color = 'r' ))
595597 return fig
596598
597599
598- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
600+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
599601def test_probplot_pp_probax_y (plot_data ):
600602 fig , ax = plt .subplots ()
601603 scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -604,7 +606,7 @@ def test_probplot_pp_probax_y(plot_data):
604606 return fig
605607
606608
607- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
609+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
608610def test_probplot_prob_bestfit_probax_y (plot_data ):
609611 fig , ax = plt .subplots ()
610612 fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , bestfit = True ,
@@ -613,15 +615,15 @@ def test_probplot_prob_bestfit_probax_y(plot_data):
613615 return fig
614616
615617
616- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
618+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
617619def test_probplot_qq_bestfit_probax_y (plot_data ):
618620 fig , ax = plt .subplots ()
619621 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True , problabel = 'Test label' ,
620622 datascale = 'log' , probax = 'y' , estimate_ci = True )
621623 return fig
622624
623625
624- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
626+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
625627def test_probplot_pp_bestfit_probax_y (plot_data ):
626628 fig , ax = plt .subplots ()
627629 scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -632,7 +634,7 @@ def test_probplot_pp_bestfit_probax_y(plot_data):
632634 return fig
633635
634636
635- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
637+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = LOOSE_TOLERANCE )
636638@pytest .mark .skipif (stats is None , reason = "no scipy" )
637639def test_probplot_beta_dist_best_fit_y (plot_data ):
638640 fig , (ax1 , ax2 ) = plt .subplots (ncols = 2 )
@@ -650,7 +652,7 @@ def test_probplot_beta_dist_best_fit_y(plot_data):
650652 return fig
651653
652654
653- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
655+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
654656@pytest .mark .skipif (stats is None , reason = "no scipy" )
655657def test_probplot_beta_dist_best_fit_x (plot_data ):
656658 fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 )
@@ -697,7 +699,7 @@ def test__set_prob_limits_x(probax, N, minval, maxval):
697699 ax .set_ylim .assert_called_once_with (bottom = minval , top = maxval )
698700
699701
700- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
702+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
701703def test_probplot_color_and_label (plot_data ):
702704 fig , ax = plt .subplots ()
703705 fig = viz .probplot (plot_data , ax = ax , color = 'pink' , label = 'A Top-Level Label' )
0 commit comments