# Perforce Defect Tracking Integration Project
#
Foo
appears in
Foo
' + end, "Test(6) [4] Attribute 'foo' is not allowed in.\n"),
('Id attribute but no name',
start + 'Foo' + end,
"Test(6) [5] element has 'id' attribute but no 'name' attribute.\n"),
('Name attribute but no id',
start + 'Foo' + end,
"Test(6) [6] element has 'name' attribute but no 'id' attribute.\n"),
('Id and name attributes differ',
start + 'Foo' + end,
"Test(6) [7] element has id 'bar' but name 'foo'.\n"),
('Empty element contains character data',
start + '
foo' + end,
"Test(6) [8]
element contains character data 'foo'.\n"),
('Element may not be empty',
start + '' + end,
"Test(6) [9]
element is empty.\n"),
('Unknown value for attribute',
start + '
' + end,
"Test(6) [10] Attribute 'clear' for element
has value 'foo' (must be one of [left, all, right, none]).\n"),
('Attribute value not a number',
start + '
' + end,
"Test(6) [11] Attribute 'value' for element ' + end,
"Test(6) [13] Attribute 'alt' is required for
but not present.\n"),
('Table element has two captions',
start + '
' + end,
"Test(6) [15] Contents of Foo element [caption, caption, tr] doesn't match XHTML specification (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+)).\n"),
('Table element has no rows',
start + '
' + end,
"Test(6) [15] Contents of element [caption] doesn't match XHTML specification (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+)).\n"),
('Table element mixes col and colgroup',
start + '
' + end,
"Test(6) [15] Contents of element [col, colgroup, tbody] doesn't match XHTML specification (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+)).\n"),
('Anchor in anchor',
start + 'baz' + end,
"Test(6) [16] Element appears below on line 6 (not allowed).\n"),
('Section anchor has no id',
start + '
Title
\nHeading
' + end,
"Test(7) [17] Section anchor has no 'id' attribute.\n"),
('Section anchor inconsistent with heading level',
start + 'Title
\n1. Heading
\nHeading
' + end,
"Test(8) [18] Anchor for has id 'section-2': should look like 'section-1.1'.\n"),
('Missing section anchor',
start + '
Title
\n1. Heading
\n1.1. Heading
\nExample
' + end,
"Test(9) [19] has no section anchor.\n"),
('Table cell with valign attribute',
start + '
' + end,
"Test(6) [20] Foo has valign attribute: better in the .\n"),
('Wrong reference anchor',
start + ' Title
\nA. References
\n\n
' + end,
"Test(9) [21] Reference anchor has id 'GDR-1971-01-02': should start with 'ref-'.\n"),
('Cross reference has no target',
start + 'Foo' + end,
"Test(6) [22] Cross-reference '#no-target' has no target.\n"),
('Cross reference should be link',
start + ' \nGDR 1971-01-02 Title
\n\nA. References
\n\n
' + end,
"Test(7) [23] Cross-reference '#ref-GDR-1971-01-03' to references section should link to target 'http://foo.invalid/' instead.\n"),
('Inconsistent heading sequence',
start + ' \n[GDR 1971-01-03] Foo Title
\n2. Foo
\n2.1.1. Bar
' + end,
"Test(8) [25] follows
""",
"Test(4) [15] Contents of element [head, body, body] doesn't match XHTML specification (head, body).\n"),
]
def tests():
suite = unittest.TestSuite()
for (name, text, error) in test_cases:
suite.addTest(case(name, text, error))
return suite
if __name__ == "__main__":
unittest.main(defaultTest="tests")
# A. REFERENCES
#
# [PyUnit] "PyUnit - a unit testing framework for Python"; Steve Purcell;
# .\n"),
('Missing attributes for img element',
start + '
' + end,
"Test(6) [26] Attribute 'height' is recommended for but not present.\n"
"Test(6) [26] Attribute 'width' is recommended for
but not present.\n"),
('Missing title attribute for abbr element',
start + 'P4DTI' + end,
"Test(6) [26] Attribute 'title' is recommended for but not present.\n"),
('Id reference has no target',
start + '
' + end,
"Test(6) [27] IDREF 'no-such-header' has no target.\n"
"Test(6) [27] IDREF 'no-sirree' has no target.\n"),
('Head element has two titles',
"""