diff options
author | dirkf <[email protected]> | 2024-03-04 20:52:58 +0000 |
---|---|---|
committer | dirkf <[email protected]> | 2024-03-08 13:03:42 +0000 |
commit | acc383b9e3c2d454121c22570c901dd2c689dc26 (patch) | |
tree | 3849199371f9767211b2d83df600569795060eb2 /test | |
parent | f0812d784836d18fd25ea32f9b5a0c9c6e92425b (diff) | |
download | youtube-dl-acc383b9e3c2d454121c22570c901dd2c689dc26.tar.gz youtube-dl-acc383b9e3c2d454121c22570c901dd2c689dc26.zip |
[utils] Let int_or_none() accept a base, like int()
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 90d64b581..ca36909a8 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -525,11 +525,14 @@ class TestUtil(unittest.TestCase): self.assertEqual(float_or_none(set()), None) def test_int_or_none(self): + self.assertEqual(int_or_none(42), 42) self.assertEqual(int_or_none('42'), 42) self.assertEqual(int_or_none(''), None) self.assertEqual(int_or_none(None), None) self.assertEqual(int_or_none([]), None) self.assertEqual(int_or_none(set()), None) + self.assertEqual(int_or_none('42', base=8), 34) + self.assertRaises(TypeError, int_or_none(42, base=8)) def test_str_to_int(self): self.assertEqual(str_to_int('123,456'), 123456) |