@@ -72,7 +72,7 @@ def plot_data():
72
72
73
73
74
74
class Test_fit_line (object ):
75
- def setup (self ):
75
+ def setup_method (self ):
76
76
self .data = numpy .array (
77
77
[
78
78
2.00 ,
@@ -454,7 +454,7 @@ def test_custom_xhat(self):
454
454
455
455
456
456
class Test_plot_pos (object ):
457
- def setup (self ):
457
+ def setup_method (self ):
458
458
self .data = numpy .arange (16 )
459
459
460
460
self .known_type4 = numpy .array (
@@ -740,11 +740,11 @@ def test_probplot_prob(plot_data):
740
740
fig , ax = plt .subplots ()
741
741
fig = viz .probplot (plot_data , ax = ax , problabel = "Test xlabel" , datascale = "log" )
742
742
assert isinstance (fig , plt .Figure )
743
- return fig
744
743
745
744
746
745
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
747
746
def test_probplot_qq (plot_data ):
747
+ plt .close ("all" )
748
748
fig , ax = plt .subplots ()
749
749
fig = viz .probplot (
750
750
plot_data ,
@@ -760,6 +760,7 @@ def test_probplot_qq(plot_data):
760
760
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
761
761
@pytest .mark .skipif (stats is None , reason = "no scipy" )
762
762
def test_probplot_qq_dist (plot_data ):
763
+ plt .close ("all" )
763
764
fig , ax = plt .subplots ()
764
765
norm = stats .norm (* stats .norm .fit (plot_data ))
765
766
fig = viz .probplot (
@@ -770,6 +771,7 @@ def test_probplot_qq_dist(plot_data):
770
771
771
772
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
772
773
def test_probplot_pp (plot_data ):
774
+ plt .close ("all" )
773
775
fig , ax = plt .subplots ()
774
776
scatter_kws = dict (
775
777
color = "b" , linestyle = "--" , markeredgecolor = "g" , markerfacecolor = "none"
@@ -792,6 +794,7 @@ def test_probplot_pp(plot_data):
792
794
remove_text = True ,
793
795
)
794
796
def test_probplot_prob_bestfit (plot_data ):
797
+ plt .close ("all" )
795
798
fig , ax = plt .subplots ()
796
799
fig = viz .probplot (
797
800
plot_data ,
@@ -807,6 +810,7 @@ def test_probplot_prob_bestfit(plot_data):
807
810
808
811
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
809
812
def test_probplot_prob_bestfit_exceedance (plot_data ):
813
+ plt .close ("all" )
810
814
fig , ax = plt .subplots ()
811
815
fig = viz .probplot (
812
816
plot_data ,
@@ -823,6 +827,7 @@ def test_probplot_prob_bestfit_exceedance(plot_data):
823
827
824
828
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
825
829
def test_probplot_qq_bestfit (plot_data ):
830
+ plt .close ("all" )
826
831
fig , ax = plt .subplots ()
827
832
fig = viz .probplot (
828
833
plot_data ,
@@ -838,6 +843,7 @@ def test_probplot_qq_bestfit(plot_data):
838
843
839
844
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
840
845
def test_probplot_pp_bestfit (plot_data ):
846
+ plt .close ("all" )
841
847
fig , ax = plt .subplots ()
842
848
scatter_kws = {"marker" : "s" , "color" : "red" }
843
849
line_kws = {"linestyle" : "--" , "linewidth" : 3 }
@@ -858,6 +864,7 @@ def test_probplot_pp_bestfit(plot_data):
858
864
859
865
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
860
866
def test_probplot_prob_probax_y (plot_data ):
867
+ plt .close ("all" )
861
868
fig , ax = plt .subplots ()
862
869
fig = viz .probplot (
863
870
plot_data , ax = ax , datalabel = "Test xlabel" , datascale = "log" , probax = "y"
@@ -868,6 +875,7 @@ def test_probplot_prob_probax_y(plot_data):
868
875
869
876
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
870
877
def test_probplot_qq_probax_y (plot_data ):
878
+ plt .close ("all" )
871
879
fig , ax = plt .subplots ()
872
880
fig = viz .probplot (
873
881
plot_data ,
@@ -883,6 +891,7 @@ def test_probplot_qq_probax_y(plot_data):
883
891
884
892
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
885
893
def test_probplot_pp_probax_y (plot_data ):
894
+ plt .close ("all" )
886
895
fig , ax = plt .subplots ()
887
896
scatter_kws = dict (
888
897
color = "b" , linestyle = "--" , markeredgecolor = "g" , markerfacecolor = "none"
@@ -902,6 +911,7 @@ def test_probplot_pp_probax_y(plot_data):
902
911
903
912
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
904
913
def test_probplot_prob_bestfit_probax_y (plot_data ):
914
+ plt .close ("all" )
905
915
fig , ax = plt .subplots ()
906
916
fig = viz .probplot (
907
917
plot_data ,
@@ -918,6 +928,7 @@ def test_probplot_prob_bestfit_probax_y(plot_data):
918
928
919
929
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
920
930
def test_probplot_qq_bestfit_probax_y (plot_data ):
931
+ plt .close ("all" )
921
932
fig , ax = plt .subplots ()
922
933
fig = viz .probplot (
923
934
plot_data ,
@@ -934,6 +945,7 @@ def test_probplot_qq_bestfit_probax_y(plot_data):
934
945
935
946
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
936
947
def test_probplot_pp_bestfit_probax_y (plot_data ):
948
+ plt .close ("all" )
937
949
fig , ax = plt .subplots ()
938
950
scatter_kws = {"marker" : "s" , "color" : "red" }
939
951
line_kws = {"linestyle" : "--" , "linewidth" : 3 }
@@ -956,6 +968,7 @@ def test_probplot_pp_bestfit_probax_y(plot_data):
956
968
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = LOOSE_TOLERANCE )
957
969
@pytest .mark .skipif (stats is None , reason = "no scipy" )
958
970
def test_probplot_beta_dist_best_fit_y (plot_data ):
971
+ plt .close ("all" )
959
972
fig , (ax1 , ax2 ) = plt .subplots (ncols = 2 )
960
973
dist = stats .beta (3 , 3 )
961
974
fig = viz .probplot (
@@ -991,6 +1004,7 @@ def test_probplot_beta_dist_best_fit_y(plot_data):
991
1004
)
992
1005
@pytest .mark .skipif (stats is None , reason = "no scipy" )
993
1006
def test_probplot_beta_dist_best_fit_x (plot_data ):
1007
+ plt .close ("all" )
994
1008
fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 )
995
1009
dist = stats .beta (3 , 3 )
996
1010
fig = viz .probplot (
@@ -1020,13 +1034,13 @@ def test_probplot_beta_dist_best_fit_x(plot_data):
1020
1034
1021
1035
1022
1036
def test_probplot_test_results (plot_data ):
1037
+ plt .close ("all" )
1023
1038
fig , ax = plt .subplots ()
1024
1039
fig , results = viz .probplot (plot_data , return_best_fit_results = True )
1025
1040
1026
1041
assert isinstance (results , dict )
1027
1042
known_keys = sorted (["q" , "x" , "y" , "xhat" , "yhat" , "res" ])
1028
1043
assert sorted (list (results .keys ())) == known_keys
1029
- return fig
1030
1044
1031
1045
1032
1046
@pytest .mark .parametrize ("probax" , ["x" , "y" ])
@@ -1048,6 +1062,7 @@ def test__set_prob_limits_x(probax, N, minval, maxval):
1048
1062
1049
1063
@pytest .mark .mpl_image_compare (baseline_dir = BASELINE_DIR , tolerance = TIGHT_TOLERANCE )
1050
1064
def test_probplot_color_and_label (plot_data ):
1065
+ plt .close ("all" )
1051
1066
fig , ax = plt .subplots ()
1052
1067
fig = viz .probplot (plot_data , ax = ax , color = "pink" , label = "A Top-Level Label" )
1053
1068
ax .legend (loc = "lower right" )
0 commit comments