aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-20 22:11:34 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-20 22:11:34 +0100
commit5aafe895fce2a7be9595cb2e56b7bd73a748e6b6 (patch)
tree092e8e5663aceb9adb7475b5b2d9c9b7ee7a84e6 /test/test_utils.py
parentb853d2e1555dbb4a09fe3d7857c6d2bc044646f4 (diff)
Correct XML ampersand fixup
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index bee355ee0..a17483ada 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -16,6 +16,7 @@ from youtube_dl.utils import (
DateRange,
encodeFilename,
find_xpath_attr,
+ fix_xml_ampersands,
get_meta_content,
orderedSet,
parse_duration,
@@ -200,5 +201,18 @@ class TestUtil(unittest.TestCase):
self.assertEqual(parse_duration('9:12:43'), 33163)
self.assertEqual(parse_duration('x:y'), None)
+ def test_fix_xml_ampersands(self):
+ self.assertEqual(
+ fix_xml_ampersands('"&x=y&z=a'), '"&amp;x=y&amp;z=a')
+ self.assertEqual(
+ fix_xml_ampersands('"&amp;x=y&wrong;&z=a'),
+ '"&amp;x=y&amp;wrong;&amp;z=a')
+ self.assertEqual(
+ fix_xml_ampersands('&amp;&apos;&gt;&lt;&quot;'),
+ '&amp;&apos;&gt;&lt;&quot;')
+ self.assertEqual(
+ fix_xml_ampersands('&#1234;&#x1abC;'), '&#1234;&#x1abC;')
+ self.assertEqual(fix_xml_ampersands('&#&#'), '&amp;#&amp;#')
+
if __name__ == '__main__':
unittest.main()