def test_verbosity_false(capsys): '''verbosity false for ks''' d1 = np.random.normal(size=1000) d2 = d1 ks(d1, d2, verbose=False) captured = capsys.readouterr() assert captured.out == ""
def test_verbosity_true_(capsys): d1 = np.random.normal(size=1000) d2 = d1 ks(d1, d2, verbose=True) captured = capsys.readouterr() assert captured.out == "\nKS: pvalue = 1.0\n\nKS: Null hypothesis cannot be rejected. Distributions not statistically different.\n" es(d1, d2, verbose=True) captured = capsys.readouterr() assert captured.out == "\nES: pvalue = 1.0\n\nES: Null hypothesis cannot be rejected. Distributions not statistically different.\n"
def test_ks_returns_small(): """ Test. """ d1 = np.random.normal(size=1000) d2 = np.random.weibull(1, size=1000) - 1 assert ks(d1, d2)[1] < 0.001
def test_ks_accepts_pd_series(): """ Test. """ d1 = pd.Series(np.random.normal(size=1000)) d2 = d1 assert ks(d1, d2)[1] == 1.0
def test_ks_returns_one(): """ Test. """ d1 = np.random.normal(size=1000) d2 = d1 assert ks(d1, d2)[1] == 1.0
def test_distribution_statistics_attributes_ks(): d1 = np.histogram(np.random.normal(size=1000), 10)[0] d2 = np.histogram(np.random.normal(size=1000), 10)[0] myTest = DistributionStatistics('ks', binning_strategy=None) _ = myTest.compute(d1, d2, verbose=False) ks_value, p_value = ks(d1, d2) assert myTest.statistic == ks_value
def test_ks_returns_small(): '''Kolmogorov-Smirnov test statistic returns small value (<0.001)''' d1 = np.random.normal(size=1000) d2 = np.random.weibull(1, size=1000) - 1 assert ks(d1, d2)[1] < 0.001
def test_ks_accepts_pd_series(): '''Kolmogorov-Smirnov test statistic accepts pd Series''' d1 = pd.Series(np.random.normal(size=1000)) d2 = d1 assert ks(d1, d2)[1] == 1.0
def test_ks_returns_one(): '''Kolmogorov-Smirnov test statistic returns one''' d1 = np.random.normal(size=1000) d2 = d1 assert ks(d1, d2)[1] == 1.0