diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 8d8997977..70050d2b8 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -40,6 +40,7 @@ from youtube_dl.utils import ( parse_iso8601, strip_jsonp, uppercase_escape, + limit_length, ) @@ -286,5 +287,12 @@ class TestUtil(unittest.TestCase): self.assertEqual(uppercase_escape('aä'), 'aä') self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐') + def test_limit_length(self): + self.assertEqual(limit_length(None, 12), None) + self.assertEqual(limit_length('foo', 12), 'foo') + self.assertTrue( + limit_length('foo bar baz asd', 12).startswith('foo bar')) + self.assertTrue('...' in limit_length('foo bar baz asd', 12)) + if __name__ == '__main__': unittest.main() |