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
cubes
postgis
Commits
dfa967d7dfce
Commit
24f0f989
authored
Jan 19, 2016
by
Julien Cristau
Browse files
[test] fix longitude/latitude confusion
parent
aa9580b5f998
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test_postgis.py
View file @
dfa967d7
...
...
@@ -33,20 +33,20 @@ class PostgisTC(testlib.CubicWebTC):
def
test_geometry_srid
(
self
):
with
self
.
admin_access
.
repo_cnx
()
as
cnx
:
cnx
.
create_entity
(
'City'
,
name
=
u
'Paris'
,
center_4326
=
(
u
'POINT(
48.4 2.3
4)'
,
4326
))
cnx
.
create_entity
(
'City'
,
name
=
u
'Paris'
,
center_4326
=
(
u
'POINT(
2.34 48.
4)'
,
4326
))
cnx
.
commit
()
self
.
assertEqual
(
cnx
.
execute
(
'Any ST_SRID(C) WHERE X center_4326 C'
)[
0
][
0
],
4326
)
# wrong srid
with
self
.
assertRaises
(
Exception
)
as
ctx
:
cnx
.
create_entity
(
'City'
,
name
=
u
'Nantes'
,
center_4326
=
(
u
'POINT(47.2
5 1.
5)'
,
-
1
))
cnx
.
create_entity
(
'City'
,
name
=
u
'Nantes'
,
center_4326
=
(
u
'POINT(
1.5
47.25)'
,
-
1
))
self
.
assertEqual
(
ctx
.
exception
.
__class__
.
__name__
,
'DataError'
)
def
test_geometry_nosrid
(
self
):
with
self
.
admin_access
.
repo_cnx
()
as
cnx
:
cnx
.
create_entity
(
'City'
,
name
=
u
'Paris'
,
center_nosrid
=
(
u
'POINT(
48.4 2.3
4)'
,
4326
))
cnx
.
create_entity
(
'City'
,
name
=
u
'Paris'
,
center_nosrid
=
(
u
'POINT(
2.34 48.
4)'
,
4326
))
cnx
.
commit
()
self
.
assertEqual
(
cnx
.
execute
(
'Any ST_SRID(C) WHERE X center_nosrid C'
)[
0
][
0
],
4326
)
cnx
.
create_entity
(
'City'
,
name
=
u
'Nantes'
,
center_nosrid
=
(
u
'POINT(47.2
5 1.
5)'
,
-
1
))
cnx
.
create_entity
(
'City'
,
name
=
u
'Nantes'
,
center_nosrid
=
(
u
'POINT(
1.5
47.25)'
,
-
1
))
cnx
.
commit
()
...
...
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