diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-11-25 09:54:54 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-11-25 09:54:54 +0100 |
commit | be64b5b098e3563d563bcf091f6f74edf22d7764 (patch) | |
tree | f07fc796c45ad281803d4f2674ba0091c8571383 /test | |
parent | c3e74731c2acd2878a38c2a2daa2ed0c11352762 (diff) |
[xminus] Simplify and extend (#4302)
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
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() |