4
4
import numpy
5
5
import matplotlib .pyplot as plt
6
6
7
- PY2K = sys .version_info .major == 2
8
- if PY2K : # pragma: no cover
7
+ PY27 = sys .version_info .major == 2
8
+ if PY27 : # pragma: no cover
9
9
import mock
10
+ TOLERANCE = 15
10
11
else :
11
12
from unittest import mock
13
+ TOLERANCE = 12
12
14
import pytest
13
15
import numpy .testing as nptest
14
16
@@ -519,23 +521,23 @@ def test__fit_ci(plot_data, fitlogs, known_lo, known_hi):
519
521
nptest .assert_allclose (yhat_hi , known_hi , rtol = 0.001 )
520
522
521
523
522
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
524
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
523
525
def test_probplot_prob (plot_data ):
524
526
fig , ax = plt .subplots ()
525
527
fig = viz .probplot (plot_data , ax = ax , problabel = 'Test xlabel' , datascale = 'log' )
526
528
assert isinstance (fig , plt .Figure )
527
529
return fig
528
530
529
531
530
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
532
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
531
533
def test_probplot_qq (plot_data ):
532
534
fig , ax = plt .subplots ()
533
535
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , datalabel = 'Test label' ,
534
536
datascale = 'log' , scatter_kws = dict (color = 'r' ))
535
537
return fig
536
538
537
539
538
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
540
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
539
541
@pytest .mark .skipif (stats is None , reason = "no scipy" )
540
542
def test_probplot_qq_dist (plot_data ):
541
543
fig , ax = plt .subplots ()
@@ -545,7 +547,7 @@ def test_probplot_qq_dist(plot_data):
545
547
return fig
546
548
547
549
548
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
550
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
549
551
def test_probplot_pp (plot_data ):
550
552
fig , ax = plt .subplots ()
551
553
scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -555,7 +557,7 @@ def test_probplot_pp(plot_data):
555
557
return fig
556
558
557
559
558
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
560
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
559
561
def test_probplot_prob_bestfit (plot_data ):
560
562
fig , ax = plt .subplots ()
561
563
fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , bestfit = True ,
@@ -564,7 +566,7 @@ def test_probplot_prob_bestfit(plot_data):
564
566
return fig
565
567
566
568
567
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
569
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
568
570
def test_probplot_qq_bestfit (plot_data ):
569
571
fig , ax = plt .subplots ()
570
572
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True ,
@@ -573,7 +575,7 @@ def test_probplot_qq_bestfit(plot_data):
573
575
return fig
574
576
575
577
576
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
578
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
577
579
def test_probplot_pp_bestfit (plot_data ):
578
580
fig , ax = plt .subplots ()
579
581
scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -585,23 +587,23 @@ def test_probplot_pp_bestfit(plot_data):
585
587
return fig
586
588
587
589
588
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
590
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
589
591
def test_probplot_prob_probax_y (plot_data ):
590
592
fig , ax = plt .subplots ()
591
593
fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , datascale = 'log' , probax = 'y' )
592
594
assert isinstance (fig , plt .Figure )
593
595
return fig
594
596
595
597
596
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
598
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
597
599
def test_probplot_qq_probax_y (plot_data ):
598
600
fig , ax = plt .subplots ()
599
601
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , problabel = 'Test label' , probax = 'y' ,
600
602
datascale = 'log' , scatter_kws = dict (color = 'r' ))
601
603
return fig
602
604
603
605
604
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
606
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
605
607
def test_probplot_pp_probax_y (plot_data ):
606
608
fig , ax = plt .subplots ()
607
609
scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -610,7 +612,7 @@ def test_probplot_pp_probax_y(plot_data):
610
612
return fig
611
613
612
614
613
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
615
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
614
616
def test_probplot_prob_bestfit_probax_y (plot_data ):
615
617
fig , ax = plt .subplots ()
616
618
fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , bestfit = True ,
@@ -619,15 +621,15 @@ def test_probplot_prob_bestfit_probax_y(plot_data):
619
621
return fig
620
622
621
623
622
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
624
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
623
625
def test_probplot_qq_bestfit_probax_y (plot_data ):
624
626
fig , ax = plt .subplots ()
625
627
fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True , problabel = 'Test label' ,
626
628
datascale = 'log' , probax = 'y' , estimate_ci = True )
627
629
return fig
628
630
629
631
630
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
632
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
631
633
def test_probplot_pp_bestfit_probax_y (plot_data ):
632
634
fig , ax = plt .subplots ()
633
635
scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -638,7 +640,7 @@ def test_probplot_pp_bestfit_probax_y(plot_data):
638
640
return fig
639
641
640
642
641
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
643
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
642
644
@pytest .mark .skipif (stats is None , reason = "no scipy" )
643
645
def test_probplot_beta_dist_best_fit_y (plot_data ):
644
646
fig , (ax1 , ax2 ) = plt .subplots (ncols = 2 )
@@ -656,7 +658,7 @@ def test_probplot_beta_dist_best_fit_y(plot_data):
656
658
return fig
657
659
658
660
659
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
661
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
660
662
@pytest .mark .skipif (stats is None , reason = "no scipy" )
661
663
def test_probplot_beta_dist_best_fit_x (plot_data ):
662
664
fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 )
@@ -702,7 +704,7 @@ def test__set_prob_limits_x(probax, N, minval, maxval):
702
704
ax .set_ylim .assert_called_once_with (bottom = minval , top = maxval )
703
705
704
706
705
- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
707
+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
706
708
def test_probplot_color_and_label (plot_data ):
707
709
fig , ax = plt .subplots ()
708
710
fig = viz .probplot (plot_data , ax = ax , color = 'pink' , label = 'A Top-Level Label' )
0 commit comments