[py3] Alias long to int in pgstore tests
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 24 Jan 2018 14:38:39 +0100
changeset 12249 676c166bbd74
parent 12248 6350e0a482d5
child 12250 afc678253bc2
[py3] Alias long to int in pgstore tests The previous version of handling PY2/PY3 made flake8 complain.
cubicweb/dataimport/test/test_pgstore.py
--- a/cubicweb/dataimport/test/test_pgstore.py	Fri Jan 12 11:02:52 2018 +0100
+++ b/cubicweb/dataimport/test/test_pgstore.py	Wed Jan 24 14:38:39 2018 +0100
@@ -20,13 +20,17 @@
 
 import datetime as DT
 
-from six import PY2
+from six import PY3
 from logilab.common.testlib import TestCase, unittest_main
 
 from cubicweb.dataimport import pgstore
 from cubicweb.devtools import testlib
 
 
+if PY3:
+    long = int
+
+
 class CreateCopyFromBufferTC(TestCase):
 
     # test converters
@@ -38,8 +42,7 @@
     def test_convert_number(self):
         cnvt = pgstore._copyfrom_buffer_convert_number
         self.assertEqual(u'42', cnvt(42))
-        if PY2:
-            self.assertEqual(u'42', cnvt(long(42)))
+        self.assertEqual(u'42', cnvt(long(42)))
         self.assertEqual(u'42.42', cnvt(42.42))
 
     def test_convert_string(self):
@@ -66,10 +69,9 @@
 
     # test buffer
     def test_create_copyfrom_buffer_tuple(self):
-        l = long if PY2 else int  # noqa: E741
-        data = ((42, l(42), 42.42, u'éléphant', DT.date(666, 1, 13), DT.time(6, 6, 6),
+        data = ((42, long(42), 42.42, u'éléphant', DT.date(666, 1, 13), DT.time(6, 6, 6),
                  DT.datetime(666, 6, 13, 6, 6, 6)),
-                (6, l(6), 6.6, u'babar', DT.date(2014, 1, 14), DT.time(4, 2, 1),
+                (6, long(6), 6.6, u'babar', DT.date(2014, 1, 14), DT.time(4, 2, 1),
                  DT.datetime(2014, 1, 1, 0, 0, 0)))
         results = pgstore._create_copyfrom_buffer(data)
         # all columns