Exemplo n.º 1
0
def main():
    return utils.run_suite(test_suite())
     ('i18nVariable',
      ('email',
       [('startTag',
         ('a',
          [('href', 'href="mailto:[email protected]"'),
           ('tal:content', 'request/submitter', 'tal'),
           ('i18n:name', 'email', 'i18n')])),
        ('insertText',
         ('$request/submitter$',
          [('rawtextOffset', ('*****@*****.**', 13))])),
        ('rawtextOffset', ('</a>', 4))],
       None,
       0)),
     ('endScope', ()),
     ('rawtextColumn', ('\n', 0))])),
  ('endScope', ()),
  ('rawtextColumn', ('</p>\n', 0))
  ])


def test_suite():
    suite = unittest.makeSuite(HTMLTALParserTestCases)
    suite.addTest(unittest.makeSuite(METALGeneratorTestCases))
    suite.addTest(unittest.makeSuite(TALGeneratorTestCases))
    return suite


if __name__ == "__main__":
    errs = utils.run_suite(test_suite())
    sys.exit(errs and 1 or 0)
Exemplo n.º 3
0
        self._parse_error("</$>")
        self._parse_error("</")
        self._parse_error("</a")
        self._parse_error("</a")
        self._parse_error("<a<a>")
        self._parse_error("</a<a>")
        self._parse_error("<$")
        self._parse_error("<$>")
        self._parse_error("<!")
        self._parse_error("<a $>")
        self._parse_error("<a")
        self._parse_error("<a foo='bar'")
        self._parse_error("<a foo='bar")
        self._parse_error("<a foo='>'")
        self._parse_error("<a foo='>")

    def test_declaration_junk_chars(self):
        self._parse_error("<!DOCTYPE foo $ >")


# Support for the Zope regression test framework:
def test_suite(skipxml=utils.skipxml):
    if skipxml:
        return unittest.TestSuite()
    else:
        return unittest.makeSuite(XMLParserTestCase)

if __name__ == "__main__":
    errs = utils.run_suite(test_suite(skipxml=0))
    sys.exit(errs and 1 or 0)
Exemplo n.º 4
0
    script = __file__
except NameError:
    script = sys.argv[0]


def test_suite():
    suite = unittest.TestSuite()
    dir = os.path.dirname(script)
    dir = os.path.abspath(dir)
    parentdir = os.path.dirname(dir)
    prefix = os.path.join(dir, "input", "test*.")
    if utils.skipxml:
        xmlargs = []
    else:
        xmlargs = glob.glob(prefix + "xml")
        xmlargs.sort()
    htmlargs = glob.glob(prefix + "html")
    htmlargs.sort()
    args = xmlargs + htmlargs
    if not args:
        sys.stderr.write("Warning: no test input files found!!!\n")
    for arg in args:
        case = FileTestCase(arg, parentdir)
        suite.addTest(case)
    return suite


if __name__ == "__main__":
    errs = utils.run_suite(test_suite())
    sys.exit(errs and 1 or 0)
Exemplo n.º 5
0
def main():
    return utils.run_suite(test_suite())
Exemplo n.º 6
0
        self._parse_error("<$")
        self._parse_error("<$>")
        self._parse_error("<!")
        self._parse_error("<a $>")
        self._parse_error("<a")
        self._parse_error("<a foo='bar'")
        self._parse_error("<a foo='bar")
        self._parse_error("<a foo='>'")
        self._parse_error("<a foo='>")

    def test_declaration_junk_chars(self):
        self._parse_error("<!DOCTYPE foo $ >")

    def test_unicode_string(self):
        output = [('starttag', u'p', []), ('data', u'\xe4\xf6\xfc\xdf'),
                  ('endtag', u'p')]
        self._run_check(u'<p>\xe4\xf6\xfc\xdf</p>', output)


# Support for the Zope regression test framework:
def test_suite(skipxml=utils.skipxml):
    if skipxml:
        return unittest.TestSuite()
    else:
        return unittest.makeSuite(XMLParserTestCase)


if __name__ == "__main__":
    errs = utils.run_suite(test_suite(skipxml=0))
    sys.exit(errs and 1 or 0)