diff options
author | Sergey M․ <[email protected]> | 2016-08-07 20:45:18 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2016-08-07 20:45:18 +0700 |
commit | a8795327cae2bfce299d770039db40a3ac4df2e3 (patch) | |
tree | ebf3425e92819d7d38434f6ed96d7faeb46469f7 /test | |
parent | d34995a9e3f596c4dd80178d99f7bd8dbc748e2b (diff) | |
download | youtube-dl-a8795327cae2bfce299d770039db40a3ac4df2e3.tar.gz youtube-dl-a8795327cae2bfce299d770039db40a3ac4df2e3.zip |
[utils] Add support TV Parental Guidelines ratings in parse_age_limit
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 5a2ae4a1e..724346886 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -42,6 +42,7 @@ from youtube_dl.utils import ( ohdave_rsa_encrypt, OnDemandPagedList, orderedSet, + parse_age_limit, parse_duration, parse_filesize, parse_count, @@ -432,6 +433,20 @@ class TestUtil(unittest.TestCase): url_basename('http://media.w3.org/2010/05/sintel/trailer.mp4'), 'trailer.mp4') + def test_parse_age_limit(self): + self.assertEqual(parse_age_limit(None), None) + self.assertEqual(parse_age_limit(False), None) + self.assertEqual(parse_age_limit('invalid'), None) + self.assertEqual(parse_age_limit(0), 0) + self.assertEqual(parse_age_limit(18), 18) + self.assertEqual(parse_age_limit(21), 21) + self.assertEqual(parse_age_limit(22), None) + self.assertEqual(parse_age_limit('18'), 18) + self.assertEqual(parse_age_limit('18+'), 18) + self.assertEqual(parse_age_limit('PG-13'), 13) + self.assertEqual(parse_age_limit('TV-14'), 14) + self.assertEqual(parse_age_limit('TV-MA'), 17) + def test_parse_duration(self): self.assertEqual(parse_duration(None), None) self.assertEqual(parse_duration(False), None) |