aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-12-15 23:15:24 +0700
committerSergey M․ <dstftw@gmail.com>2019-12-15 23:15:24 +0700
commit42db58ec7367e7ee6555e5f14107712add61d013 (patch)
tree9af78bcdd1121277ebd14be175119604c6a7fa5c /test
parent73d8f3a63426e8517143e3a5554e12d614c5cdec (diff)
[utils] Improve str_to_int
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index fed94a906..0896f4150 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -500,6 +500,11 @@ class TestUtil(unittest.TestCase):
self.assertEqual(str_to_int('123,456'), 123456)
self.assertEqual(str_to_int('123.456'), 123456)
self.assertEqual(str_to_int(523), 523)
+ # Python 3 has no long
+ if sys.version_info < (3, 0):
+ eval('self.assertEqual(str_to_int(123456L), 123456)')
+ self.assertEqual(str_to_int('noninteger'), None)
+ self.assertEqual(str_to_int([]), None)
def test_url_basename(self):
self.assertEqual(url_basename('http://foo.de/'), '')