From be64b5b098e3563d563bcf091f6f74edf22d7764 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Tue, 25 Nov 2014 09:54:54 +0100 Subject: [xminus] Simplify and extend (#4302) --- test/test_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/test_utils.py b/test/test_utils.py index 8307599b3..9dc879e0d 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -47,6 +47,7 @@ from youtube_dl.utils import ( js_to_json, intlist_to_bytes, args_to_str, + parse_filesize, ) @@ -367,5 +368,14 @@ class TestUtil(unittest.TestCase): 'foo ba/r -baz \'2 be\' \'\'' ) + def test_parse_filesize(self): + self.assertEqual(parse_filesize(None), None) + self.assertEqual(parse_filesize(''), None) + self.assertEqual(parse_filesize('91 B'), 91) + self.assertEqual(parse_filesize('foobar'), None) + self.assertEqual(parse_filesize('2 MiB'), 2097152) + self.assertEqual(parse_filesize('5 GB'), 5000000000) + self.assertEqual(parse_filesize('1.2Tb'), 1200000000000) + if __name__ == '__main__': unittest.main() -- cgit v1.2.3