Exemple #1
0
def test_generate_annotation():
    checker_ok = CheckResult(True)
    checker_not_ok = CheckResult(False, [('section 1', [[1, 2, 3], [4, 5, 6]]),
                                         ('section 2', [[7, 8, 9], [10, 11, 12]])])

    settings = {'color': 'blue', 'label': 'circle', 'name': 'dangling'}
    assert generate_annotation(checker_ok, settings) == ""

    correct_result = """

(circle   ; MUK_ANNOTATION
    (Color blue)   ; MUK_ANNOTATION
    (Name "dangling")   ; MUK_ANNOTATION
    (      1.00       2.00       3.00 0.50)   ; MUK_ANNOTATION
    (      4.00       5.00       6.00 0.50)   ; MUK_ANNOTATION
    (      7.00       8.00       9.00 0.50)   ; MUK_ANNOTATION
    (     10.00      11.00      12.00 0.50)   ; MUK_ANNOTATION
)   ; MUK_ANNOTATION
"""

    assert generate_annotation(checker_not_ok, settings) == correct_result
Exemple #2
0
def test_generate_annotation():
    checker_ok = CheckResult(True)
    checker_not_ok = CheckResult(False,
                                 [('section 1', [[1, 2, 3], [4, 5, 6]]),
                                  ('section 2', [[7, 8, 9], [10, 11, 12]])])

    settings = {'color': 'blue', 'label': 'circle', 'name': 'dangling'}
    nt.assert_equal(generate_annotation(checker_ok, settings), "")

    correct_result = """

(circle   ; MUK_ANNOTATION
    (Color blue)   ; MUK_ANNOTATION
    (Name "dangling")   ; MUK_ANNOTATION
    (1 2 3 0.50)   ; MUK_ANNOTATION
    (4 5 6 0.50)   ; MUK_ANNOTATION
    (7 8 9 0.50)   ; MUK_ANNOTATION
    (10 11 12 0.50)   ; MUK_ANNOTATION
)   ; MUK_ANNOTATION
"""

    nt.assert_equal(generate_annotation(checker_not_ok, settings),
                    correct_result)