| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d9f62c0 commit 14ee2b6
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,9 +35,6 @@ | |||
| 35 | 35 | 'onmousewheel', 'onresize', 'onscroll', 'onselect', 'onsubmit', 'onunload'] | |
| 36 | 36 | # XXX lang in HTML only, xml:lang in XHTML only | |
| 37 | 37 | ||
| 38 | - modAttributes = ['cite', 'datetime'] | ||
| 39 | - mediaAttributes = ['src', 'autoplay', 'start', 'loopstart', 'loopend', 'end', | ||
| 40 | - 'loopcount', 'controls'], | ||
| 41 | 38 | allowedAttributeMap = { | |
| 42 | 39 | 'html': ['xmlns'], | |
| 43 | 40 | 'base': ['href', 'target'], | |
@@ -52,14 +49,16 @@ | |||
| 52 | 49 | 'time': ['datetime'], | |
| 53 | 50 | 'meter': ['value', 'min', 'low', 'high', 'max', 'optimum'], | |
| 54 | 51 | 'progress': ['value', 'max'], | |
| 55 | - 'ins': modAttributes, | ||
| 56 | - 'del': modAttributes, | ||
| 52 | + 'ins': ['cite', 'datetime'], | ||
| 53 | + 'del': ['cite', 'datetime'], | ||
| 57 | 54 | 'img': ['alt', 'src', 'usemap', 'ismap', 'height', 'width'], # XXX ismap depends on parent | |
| 58 | 55 | 'iframe': ['src'], | |
| 59 | 56 | 'object': ['data', 'type', 'usemap', 'height', 'width'], | |
| 60 | 57 | 'param': ['name', 'value'], | |
| 61 | - 'video': mediaAttributes, | ||
| 62 | - 'audio': mediaAttributes, | ||
| 58 | + 'video': ['src', 'autoplay', 'start', 'loopstart', 'loopend', 'end', | ||
| 59 | + 'loopcount', 'controls'], | ||
| 60 | + 'audio': ['src', 'autoplay', 'start', 'loopstart', 'loopend', 'end', | ||
| 61 | + 'loopcount', 'controls'], | ||
| 63 | 62 | 'source': ['src', 'type', 'media'], | |
| 64 | 63 | 'canvas': ['height', 'width'], | |
| 65 | 64 | 'area': ['alt', 'coords', 'shape', 'href', 'target', 'ping', 'rel', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + import os, unittest | ||
| 2 | + from support import simplejson, html5lib_test_files | ||
| 3 | + from html5lib.html5parser import HTMLParser | ||
| 4 | + from html5lib.filters.validator import HTMLConformanceChecker | ||
| 5 | + | ||
| 6 | + class TestCase(unittest.TestCase): | ||
| 7 | + def runValidatorTest(self, test): | ||
| 8 | + p = HTMLParser(tokenizer=HTMLConformanceChecker) | ||
| 9 | + p.parse(test['input']) | ||
| 10 | + errorCodes = [errorcode for position, errorcode, datavars in p.errors] | ||
| 11 | + if test.has_key('fail-if'): | ||
| 12 | + self.failIf(test['fail-if'] in errorCodes) | ||
| 13 | + if test.has_key('fail-unless'): | ||
| 14 | + self.failUnless(test['fail-unless'] in errorCodes) | ||
| 15 | + | ||
| 16 | + def buildTestSuite(): | ||
| 17 | + for filename in html5lib_test_files('validator', '*.test'): | ||
| 18 | + tests = simplejson.load(file(filename)) | ||
| 19 | + testName = os.path.basename(filename).replace(".test","") | ||
| 20 | + for index,test in enumerate(tests['tests']): | ||
| 21 | + def testFunc(self, test=test): | ||
| 22 | + self.runValidatorTest(test) | ||
| 23 | + testFunc.__doc__ = "\t".join([testName, test['description']]) | ||
| 24 | + setattr(TestCase, 'test_%s_%d' % (testName, index), testFunc) | ||
| 25 | + return unittest.TestLoader().loadTestsFromTestCase(TestCase) | ||
| 26 | + | ||
| 27 | + def main(): | ||
| 28 | + buildTestSuite() | ||
| 29 | + unittest.main() | ||
| 30 | + | ||
| 31 | + if __name__ == "__main__": | ||
| 32 | + main() | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments