Exemple #1
0
def shouldAbideByQcIfMetricIsNotAffected():
    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_THAN)
    assert True is qc.abidesByQC(15, CommonMetrics.METERS)
Exemple #2
0
def shouldCorrectlyCompareMetrics():
    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_THAN)
    assert True is qc.abidesByQC(14, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_OR_EQUAL_TO)
    assert True is qc.abidesByQC(14, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_OR_EQUAL_TO)
    assert True is qc.abidesByQC(15, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.EQUAL_TO)
    assert True is qc.abidesByQC(15, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.GREATER_OR_EQUAL_TO)
    assert True is qc.abidesByQC(15, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.GREATER_OR_EQUAL_TO)
    assert True is qc.abidesByQC(16, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.GREATER_THAN)
    assert True is qc.abidesByQC(16, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_THAN)
    assert False is qc.abidesByQC(16, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_OR_EQUAL_TO)
    assert False is qc.abidesByQC(16, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.EQUAL_TO)
    assert False is qc.abidesByQC(16, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.GREATER_OR_EQUAL_TO)
    assert False is qc.abidesByQC(14, CommonMetrics.SECONDS)

    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.GREATER_THAN)
    assert False is qc.abidesByQC(14, CommonMetrics.SECONDS)
Exemple #3
0
def test_shouldBeBetterThan():
    qc = QualityConstraint(Context("C1"), CommonMetrics.SECONDS, 15,
                           Comparison.LESS_THAN)
    assert True is qc.abidesByQC(13, CommonMetrics.SECONDS)
    assert False is qc.abidesByQC(16, CommonMetrics.SECONDS)