コード例 #1
0
    def test_defaults(self):
        self.assertEqual(pyexpat.get_reset_dtd(), False)
        self.assertEqual(pyexpat.get_max_entity_expansions(),
                         pyexpat.XML_DEFAULT_MAX_ENTITY_EXPANSIONS)
        self.assertEqual(pyexpat.get_max_entity_indirections(),
                         pyexpat.XML_DEFAULT_MAX_ENTITY_INDIRECTIONS)

        pyexpat.set_reset_dtd(True)
        pyexpat.set_max_entity_expansions(10)
        pyexpat.set_max_entity_indirections(10)

        self.assertEqual(pyexpat.get_reset_dtd(), True)
        self.assertEqual(pyexpat.get_max_entity_expansions(), 10)
        self.assertEqual(pyexpat.get_max_entity_indirections(), 10)

        p = pyexpat.ParserCreate()
        self.assertEqual(p.max_entity_indirections, 10)
        self.assertEqual(p.max_entity_expansions, 10)
        self.assertEqual(p.reset_dtd, True)
コード例 #2
0
ファイル: tests.py プロジェクト: tiran/defusedexpat
    def test_defaults(self):
        self.assertEqual(pyexpat.get_reset_dtd(), False)
        self.assertEqual(pyexpat.get_max_entity_expansions(),
                         pyexpat.XML_DEFAULT_MAX_ENTITY_EXPANSIONS)
        self.assertEqual(pyexpat.get_max_entity_indirections(),
                         pyexpat.XML_DEFAULT_MAX_ENTITY_INDIRECTIONS)

        pyexpat.set_reset_dtd(True)
        pyexpat.set_max_entity_expansions(10)
        pyexpat.set_max_entity_indirections(10)

        self.assertEqual(pyexpat.get_reset_dtd(), True)
        self.assertEqual(pyexpat.get_max_entity_expansions(), 10)
        self.assertEqual(pyexpat.get_max_entity_indirections(), 10)

        p = pyexpat.ParserCreate()
        self.assertEqual(p.max_entity_indirections, 10)
        self.assertEqual(p.max_entity_expansions, 10)
        self.assertEqual(p.reset_dtd, True)
コード例 #3
0
 def setUp(self):
     pyexpat.set_reset_dtd(False)
     pyexpat.set_max_entity_expansions(
         pyexpat.XML_DEFAULT_MAX_ENTITY_EXPANSIONS)
     pyexpat.set_max_entity_indirections(
         pyexpat.XML_DEFAULT_MAX_ENTITY_INDIRECTIONS)
コード例 #4
0
ファイル: tests.py プロジェクト: tiran/defusedexpat
 def setUp(self):
     pyexpat.set_reset_dtd(False)
     pyexpat.set_max_entity_expansions(
         pyexpat.XML_DEFAULT_MAX_ENTITY_EXPANSIONS)
     pyexpat.set_max_entity_indirections(
         pyexpat.XML_DEFAULT_MAX_ENTITY_INDIRECTIONS)