Example #1
0
def test_stats_no_successful_expectations():
    expectation_results = [ExpectationValidationResult(success=False)]
    actual = _calc_validation_statistics(expectation_results)
    expected = ValidationStatistics(1, 0, 1, 0.0, False)
    assert expected == actual

    expectation_results = [
        ExpectationValidationResult(success=False),
        ExpectationValidationResult(success=False),
        ExpectationValidationResult(success=False),
    ]
    actual = _calc_validation_statistics(expectation_results)
    expected = ValidationStatistics(3, 0, 3, 0.0, False)
    assert expected == actual
Example #2
0
def test_stats_all_successful_expectations():
    expectation_results = [
        ExpectationValidationResult(success=True),
    ]
    actual = _calc_validation_statistics(expectation_results)
    expected = ValidationStatistics(1, 1, 0, 100.0, True)
    assert expected == actual

    expectation_results = [
        ExpectationValidationResult(success=True),
        ExpectationValidationResult(success=True),
        ExpectationValidationResult(success=True),
    ]
    actual = _calc_validation_statistics(expectation_results)
    expected = ValidationStatistics(3, 3, 0, 100.0, True)
    assert expected == actual
    def test_all_succesful_expectations(self):
        expectation_results = [
            {"success": True},
        ]
        actual = _calc_validation_statistics(expectation_results)
        expected = ValidationStatistics(1, 1, 0, 100.0, True)
        assertDeepAlmostEqual(actual, expected)

        expectation_results = [
            {"success": True},
            {"success": True},
            {"success": True},
        ]
        actual = _calc_validation_statistics(expectation_results)
        expected = ValidationStatistics(3, 3, 0, 100.0, True)
        assertDeepAlmostEqual(actual, expected)
    def test_no_succesful_expectations(self):
        expectation_results = [
            {"success": False},
        ]
        actual = _calc_validation_statistics(expectation_results)
        expected = ValidationStatistics(1, 0, 1, 0., False)
        assertDeepAlmostEqual(actual, expected)

        expectation_results = [
            {"success": False},
            {"success": False},
            {"success": False},
        ]
        actual = _calc_validation_statistics(expectation_results)
        expected = ValidationStatistics(3, 0, 3, 0., False)
        assertDeepAlmostEqual(actual, expected)
Example #5
0
def test_stats_mixed_expectations():
    expectation_results = [
        ExpectationValidationResult(success=False),
        ExpectationValidationResult(success=True),
    ]
    actual = _calc_validation_statistics(expectation_results)
    expected = ValidationStatistics(2, 1, 1, 50.0, False)
    assert expected == actual
 def test_mixed_expectations(self):
     expectation_results = [
         {"success": False},
         {"success": True},
     ]
     actual = _calc_validation_statistics(expectation_results)
     expected = ValidationStatistics(2, 1, 1, 50.0, False)
     assertDeepAlmostEqual(actual, expected)
Example #7
0
def test_stats_no_expectations():
    expectation_results = []
    actual = _calc_validation_statistics(expectation_results)

    # pay attention to these two
    assert None is actual.success_percent
    assert True is actual.success
    # the rest is boring
    assert 0 == actual.successful_expectations
    assert 0 == actual.evaluated_expectations
    assert 0 == actual.unsuccessful_expectations
Example #8
0
    def test_no_expectations(self):
        expectation_results = []
        actual = _calc_validation_statistics(expectation_results)

        # pay attention to these two
        self.assertEqual(actual.success_percent, None)
        self.assertEqual(actual.success, True)
        # the rest is boring
        self.assertEqual(actual.successful_expectations, 0)
        self.assertEqual(actual.evaluated_expectations, 0)
        self.assertEqual(actual.unsuccessful_expectations, 0)