def test_normal(mean, stddev, offset): # create 100 buckets, from -5.0 to 4.9 inclusive x_values = [(.01 * i - 5) for i in range(1001)] y_values = [(norm.cdf(right) - norm.cdf(left)) for left, right in zip(x_values, x_values[1:])] points = [Point(x, y) for x, y in zip(x_values, y_values)] assert "???" == analysers.get_analysis(points=points)
def test_normal(mean, stddev, offset): # create 100 buckets, from -5.0 to 4.9 inclusive x_values = [(.01 * i - 5) for i in range(1001)] y_values = [100 * (phi(right) - phi(left)) for left, right in zip(x_values, x_values[1:])] points = [Point(x, y) for x, y in zip(x_values, y_values)] analyser = analysers.get_analysis(points=points) assert analyser['name'] == 'normal'
def test_perfect_linear(gradient, constant): """ First, check we get a perfect validity score for straight lines. Then ensure that the analyser selector chooses the LinearAnalyser for these series. """ points = [Point(i, gradient * i + constant) for i in range(20)] ld = analysers.LinearDistribution(points=points) assert ld.get_validity() == 1.0 result = analysers.get_analysis(points=points) assert result["name"] == "linear" assert result["p_value"] == 1.0