Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
676c166bbd74
Commit
c2832ae5
authored
Jan 24, 2018
by
Denis Laxalde
Browse files
[py3] Alias long to int in pgstore tests
The previous version of handling PY2/PY3 made flake8 complain.
parent
6350e0a482d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
cubicweb/dataimport/test/test_pgstore.py
View file @
676c166b
...
...
@@ -20,13 +20,17 @@
import
datetime
as
DT
from
six
import
PY
2
from
six
import
PY
3
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 @@ class CreateCopyFromBufferTC(TestCase):
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 @@ class CreateCopyFromBufferTC(TestCase):
# 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
,
l
ong
(
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment