aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-03-24 23:21:20 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-03-24 23:21:20 +0100
commitfac55558ad55344d72cf66033e5f2d2076b2f8cb (patch)
tree30c2f3daf930009e15cce4144e9b9920be36bf5b /test
parent7a249480b47767dcd5b872563fd715afd01f777a (diff)
[washingtonpost] Add extractor (Fixes #2622)
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index e920d661f..2348c0415 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -10,6 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Various small unit tests
import io
+import json
import xml.etree.ElementTree
#from youtube_dl.utils import htmlentity_transform
@@ -36,6 +37,7 @@ from youtube_dl.utils import (
urlencode_postdata,
xpath_with_ns,
parse_iso8601,
+ strip_jsonp,
)
if sys.version_info < (3, 0):
@@ -272,5 +274,11 @@ class TestUtil(unittest.TestCase):
self.assertEqual(parse_iso8601('2014-03-23T22:04:26+0000'), 1395612266)
self.assertEqual(parse_iso8601('2014-03-23T22:04:26Z'), 1395612266)
+ def test_strip_jsonp(self):
+ stripped = strip_jsonp('cb ([ {"id":"532cb",\n\n\n"x":\n3}\n]\n);')
+ d = json.loads(stripped)
+ self.assertEqual(d, [{"id": "532cb", "x": 3}])
+
+
if __name__ == '__main__':
unittest.main()