Exemplo n.º 1
0
class TestXmlFormatInfo(unittest.TestCase):
    def setUp(self):
        self.format = XmlFormatInfo()

    def test_escape(self):
        for c in "<", ">", "'", '&', '"':
            s = c.join(['blah', 'blah', 'and blah'])
            s = self.format._escape(s)
            if c != '&':
                self.assertFalse(c in s)
            self.assertTrue(s.count('&'), 2)
            self.assertTrue(s.count(';'), 2)

    def test_unescape(self):
        for c in "&lt;", "&gt;", "&apos;", "&amp;", "&quot;":
            s = c.join(['blah', 'blah', 'and blah'])
            s = self.format._unescape(s)
            self.assertFalse(c in s)
Exemplo n.º 2
0
class TestXmlFormatInfo(unittest.TestCase):

    def setUp(self):
        self.format = XmlFormatInfo()

    def test_escape(self):
        for c in "<", ">", "'", '&', '"':
            s = c.join(['blah', 'blah', 'and blah'])
            s = self.format._escape(s)
            if c != '&':
                self.assertFalse(c in s)
            self.assertTrue(s.count('&'), 2)
            self.assertTrue(s.count(';'), 2)

    def test_unescape(self):
        for c in "&lt;", "&gt;", "&apos;", "&amp;", "&quot;":
            s = c.join(['blah', 'blah', 'and blah'])
            s = self.format._unescape(s)
            self.assertFalse(c in s)
Exemplo n.º 3
0
 def setUp(self):
     self.format = XmlFormatInfo()
Exemplo n.º 4
0
 def setUp(self):
     self.format = XmlFormatInfo()