44import numpy
55import matplotlib .pyplot as plt
66
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
99 import mock
10+ TOLERANCE = 15
1011else :
1112 from unittest import mock
13+ TOLERANCE = 12
1214import pytest
1315import numpy .testing as nptest
1416
@@ -519,23 +521,23 @@ def test__fit_ci(plot_data, fitlogs, known_lo, known_hi):
519521 nptest .assert_allclose (yhat_hi , known_hi , rtol = 0.001 )
520522
521523
522- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
524+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
523525def test_probplot_prob (plot_data ):
524526 fig , ax = plt .subplots ()
525527 fig = viz .probplot (plot_data , ax = ax , problabel = 'Test xlabel' , datascale = 'log' )
526528 assert isinstance (fig , plt .Figure )
527529 return fig
528530
529531
530- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
532+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
531533def test_probplot_qq (plot_data ):
532534 fig , ax = plt .subplots ()
533535 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , datalabel = 'Test label' ,
534536 datascale = 'log' , scatter_kws = dict (color = 'r' ))
535537 return fig
536538
537539
538- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
540+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
539541@pytest .mark .skipif (stats is None , reason = "no scipy" )
540542def test_probplot_qq_dist (plot_data ):
541543 fig , ax = plt .subplots ()
@@ -545,7 +547,7 @@ def test_probplot_qq_dist(plot_data):
545547 return fig
546548
547549
548- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
550+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
549551def test_probplot_pp (plot_data ):
550552 fig , ax = plt .subplots ()
551553 scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -555,7 +557,7 @@ def test_probplot_pp(plot_data):
555557 return fig
556558
557559
558- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
560+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
559561def test_probplot_prob_bestfit (plot_data ):
560562 fig , ax = plt .subplots ()
561563 fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , bestfit = True ,
@@ -564,7 +566,7 @@ def test_probplot_prob_bestfit(plot_data):
564566 return fig
565567
566568
567- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
569+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
568570def test_probplot_qq_bestfit (plot_data ):
569571 fig , ax = plt .subplots ()
570572 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True ,
@@ -573,7 +575,7 @@ def test_probplot_qq_bestfit(plot_data):
573575 return fig
574576
575577
576- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
578+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
577579def test_probplot_pp_bestfit (plot_data ):
578580 fig , ax = plt .subplots ()
579581 scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -585,23 +587,23 @@ def test_probplot_pp_bestfit(plot_data):
585587 return fig
586588
587589
588- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
590+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
589591def test_probplot_prob_probax_y (plot_data ):
590592 fig , ax = plt .subplots ()
591593 fig = viz .probplot (plot_data , ax = ax , datalabel = 'Test xlabel' , datascale = 'log' , probax = 'y' )
592594 assert isinstance (fig , plt .Figure )
593595 return fig
594596
595597
596- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
598+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
597599def test_probplot_qq_probax_y (plot_data ):
598600 fig , ax = plt .subplots ()
599601 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , problabel = 'Test label' , probax = 'y' ,
600602 datascale = 'log' , scatter_kws = dict (color = 'r' ))
601603 return fig
602604
603605
604- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
606+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
605607def test_probplot_pp_probax_y (plot_data ):
606608 fig , ax = plt .subplots ()
607609 scatter_kws = dict (color = 'b' , linestyle = '--' , markeredgecolor = 'g' , markerfacecolor = 'none' )
@@ -610,7 +612,7 @@ def test_probplot_pp_probax_y(plot_data):
610612 return fig
611613
612614
613- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
615+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
614616def test_probplot_prob_bestfit_probax_y (plot_data ):
615617 fig , ax = plt .subplots ()
616618 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):
619621 return fig
620622
621623
622- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
624+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
623625def test_probplot_qq_bestfit_probax_y (plot_data ):
624626 fig , ax = plt .subplots ()
625627 fig = viz .probplot (plot_data , ax = ax , plottype = 'qq' , bestfit = True , problabel = 'Test label' ,
626628 datascale = 'log' , probax = 'y' , estimate_ci = True )
627629 return fig
628630
629631
630- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
632+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
631633def test_probplot_pp_bestfit_probax_y (plot_data ):
632634 fig , ax = plt .subplots ()
633635 scatter_kws = {'marker' : 's' , 'color' : 'red' }
@@ -638,7 +640,7 @@ def test_probplot_pp_bestfit_probax_y(plot_data):
638640 return fig
639641
640642
641- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
643+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
642644@pytest .mark .skipif (stats is None , reason = "no scipy" )
643645def test_probplot_beta_dist_best_fit_y (plot_data ):
644646 fig , (ax1 , ax2 ) = plt .subplots (ncols = 2 )
@@ -656,7 +658,7 @@ def test_probplot_beta_dist_best_fit_y(plot_data):
656658 return fig
657659
658660
659- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
661+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
660662@pytest .mark .skipif (stats is None , reason = "no scipy" )
661663def test_probplot_beta_dist_best_fit_x (plot_data ):
662664 fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 )
@@ -702,7 +704,7 @@ def test__set_prob_limits_x(probax, N, minval, maxval):
702704 ax .set_ylim .assert_called_once_with (bottom = minval , top = maxval )
703705
704706
705- @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = 10 )
707+ @pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TOLERANCE )
706708def test_probplot_color_and_label (plot_data ):
707709 fig , ax = plt .subplots ()
708710 fig = viz .probplot (plot_data , ax = ax , color = 'pink' , label = 'A Top-Level Label' )
0 commit comments