19
19
PY27 = sys .version_info .major == 2
20
20
if PY27 : # pragma: no cover
21
21
import mock
22
- TOLERANCE = 15
22
+ TIGHT_TOLERANCE = 15
23
+ LOOSE_TOLERANCE = 18
23
24
else :
24
25
from unittest import mock
25
- TOLERANCE = 12
26
+ TIGHT_TOLERANCE = 13
27
+ LOOSE_TOLERANCE = 18
26
28
27
29
28
30
BASELINE_DIR = 'baseline_images/test_viz'
@@ -513,23 +515,23 @@ def test__fit_ci(plot_data, fitlogs, known_lo, known_hi):
513
515
nptest .assert_allclose (yhat_hi , known_hi , rtol = 0.001 )
514
516
515
517
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 )
517
519
def test_probplot_prob (plot_data ):
518
520
fig , ax = plt .subplots ()
519
521
fig = viz .probplot (plot_data , ax = ax , problabel = 'Test xlabel' , datascale = 'log' )
520
522
assert isinstance (fig , plt .Figure )
521
523
return fig
522
524
523
525
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 )
525
527
def test_probplot_qq (plot_data ):
526
528
fig , ax = plt .subplots ()
527
529
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , datalabel = 'Test label' ,
528
530
datascale = 'log' , scatter_kws = dict (color = 'r' ))
529
531
return fig
530
532
531
533
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 )
533
535
@pytest .mark .skipif (stats is None , reason = "no scipy" )
534
536
def test_probplot_qq_dist (plot_data ):
535
537
fig , ax = plt .subplots ()
@@ -539,7 +541,7 @@ def test_probplot_qq_dist(plot_data):
539
541
return fig
540
542
541
543
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 )
543
545
def test_probplot_pp (plot_data ):
544
546
fig , ax = plt .subplots ()
545
547
scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -549,7 +551,7 @@ def test_probplot_pp(plot_data):
549
551
return fig
550
552
551
553
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 )
553
555
def test_probplot_prob_bestfit (plot_data ):
554
556
fig , ax = plt .subplots ()
555
557
fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , bestfit = True ,
@@ -558,7 +560,7 @@ def test_probplot_prob_bestfit(plot_data):
558
560
return fig
559
561
560
562
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 )
562
564
def test_probplot_qq_bestfit (plot_data ):
563
565
fig , ax = plt .subplots ()
564
566
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True ,
@@ -567,7 +569,7 @@ def test_probplot_qq_bestfit(plot_data):
567
569
return fig
568
570
569
571
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 )
571
573
def test_probplot_pp_bestfit (plot_data ):
572
574
fig , ax = plt .subplots ()
573
575
scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -579,23 +581,23 @@ def test_probplot_pp_bestfit(plot_data):
579
581
return fig
580
582
581
583
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 )
583
585
def test_probplot_prob_probax_y (plot_data ):
584
586
fig , ax = plt .subplots ()
585
587
fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , datascale = 'log' , probax = 'y' )
586
588
assert isinstance (fig , plt .Figure )
587
589
return fig
588
590
589
591
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 )
591
593
def test_probplot_qq_probax_y (plot_data ):
592
594
fig , ax = plt .subplots ()
593
595
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , problabel = 'Test label' , probax = 'y' ,
594
596
datascale = 'log' , scatter_kws = dict (color = 'r' ))
595
597
return fig
596
598
597
599
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 )
599
601
def test_probplot_pp_probax_y (plot_data ):
600
602
fig , ax = plt .subplots ()
601
603
scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -604,7 +606,7 @@ def test_probplot_pp_probax_y(plot_data):
604
606
return fig
605
607
606
608
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 )
608
610
def test_probplot_prob_bestfit_probax_y (plot_data ):
609
611
fig , ax = plt .subplots ()
610
612
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):
613
615
return fig
614
616
615
617
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 )
617
619
def test_probplot_qq_bestfit_probax_y (plot_data ):
618
620
fig , ax = plt .subplots ()
619
621
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True , problabel = 'Test label' ,
620
622
datascale = 'log' , probax = 'y' , estimate_ci = True )
621
623
return fig
622
624
623
625
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 )
625
627
def test_probplot_pp_bestfit_probax_y (plot_data ):
626
628
fig , ax = plt .subplots ()
627
629
scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -632,7 +634,7 @@ def test_probplot_pp_bestfit_probax_y(plot_data):
632
634
return fig
633
635
634
636
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 )
636
638
@pytest .mark .skipif (stats is None , reason = "no scipy" )
637
639
def test_probplot_beta_dist_best_fit_y (plot_data ):
638
640
fig , (ax1 , ax2 ) = plt .subplots (ncols = 2 )
@@ -650,7 +652,7 @@ def test_probplot_beta_dist_best_fit_y(plot_data):
650
652
return fig
651
653
652
654
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 )
654
656
@pytest .mark .skipif (stats is None , reason = "no scipy" )
655
657
def test_probplot_beta_dist_best_fit_x (plot_data ):
656
658
fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 )
@@ -697,7 +699,7 @@ def test__set_prob_limits_x(probax, N, minval, maxval):
697
699
ax .set_ylim .assert_called_once_with (bottom = minval , top = maxval )
698
700
699
701
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 )
701
703
def test_probplot_color_and_label (plot_data ):
702
704
fig , ax = plt .subplots ()
703
705
fig = viz .probplot (plot_data , ax = ax , color = 'pink' , label = 'A Top-Level Label' )
0 commit comments