コード例 #1
0
ファイル: test_parsehtml.py プロジェクト: Arcanfel/whatToPlay
    def runTest(self):
        p = YadisHTMLParser()
        try:
            p.feed(self.case)
        except ParseDone, why:
            found = why[0]

            # make sure we protect outselves against accidental bogus
            # test cases
            assert found not in self.reserved_values

            # convert to a string
            if found is None:
                found = 'None'

            msg = "%r != %r for case %s" % (found, self.expected, self.case)
            self.failUnlessEqual(found, self.expected, msg)
コード例 #2
0
    def runTest(self):
        p = YadisHTMLParser()
        try:
            p.feed(self.case)
        except ParseDone, why:
            found = why[0]

            # make sure we protect outselves against accidental bogus
            # test cases
            assert found not in self.reserved_values

            # convert to a string
            if found is None:
                found = 'None'

            msg = "%r != %r for case %s" % (found, self.expected, self.case)
            self.failUnlessEqual(found, self.expected, msg)
コード例 #3
0
    def runTest(self):
        p = YadisHTMLParser()
        try:
            p.feed(self.case)
        except ParseDone as why:
            found = why.args[0]

            # make sure we protect outselves against accidental bogus
            # test cases
            assert found not in self.reserved_values

            # convert to a string
            if found is None:
                found = 'None'

            msg = "%r != %r for case %s" % (found, self.expected, self.case)
            self.assertEqual(found, self.expected, msg)
        else:
            self.assertTrue(self.expected == 'EOF', (self.case, self.expected))
コード例 #4
0
    def test(self):
        for expected, case in getCases():
            p = YadisHTMLParser()
            try:
                p.feed(case)
            except ParseDone as why:
                found = why[0]

                # make sure we protect outselves against accidental bogus
                # test cases
                assert found not in self.reserved_values

                # convert to a string
                if found is None:
                    found = 'None'

                msg = "%r != %r for case %s" % (found, expected, case)
                self.assertEqual(found, expected, msg)
            except HTMLParseError:
                self.assertEqual(expected, 'None', (case, expected))
            else:
                self.assertEqual(expected, 'EOF', (case, expected))