GeoAlchemy2 0.15.1__tar.gz → 0.15.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.pre-commit-config.yaml +4 -4
  2. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/CHANGES.txt +5 -0
  3. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2/GeoAlchemy2.egg-info}/PKG-INFO +1 -1
  4. {geoalchemy2-0.15.1/GeoAlchemy2.egg-info → geoalchemy2-0.15.2}/PKG-INFO +1 -1
  5. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/elements.py +1 -1
  6. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/dialects/sqlite.py +5 -0
  7. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/__init__.py +4 -5
  8. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_functional.py +26 -0
  9. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_functional_sqlite.py +48 -0
  10. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.codespellrc +0 -0
  11. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.coveragerc +0 -0
  12. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.flake8 +0 -0
  13. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
  14. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  15. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
  16. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/ISSUE_TEMPLATE/how_to_use.yaml +0 -0
  17. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/dependabot.yml +0 -0
  18. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/pull_request_template.md +0 -0
  19. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.github/workflows/test_and_publish.yml +0 -0
  20. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.gitignore +0 -0
  21. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/.readthedocs.yaml +0 -0
  22. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/COPYING.rst +0 -0
  23. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/GeoAlchemy2.egg-info/SOURCES.txt +0 -0
  24. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/GeoAlchemy2.egg-info/dependency_links.txt +0 -0
  25. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/GeoAlchemy2.egg-info/not-zip-safe +0 -0
  26. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/GeoAlchemy2.egg-info/requires.txt +0 -0
  27. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/GeoAlchemy2.egg-info/top_level.txt +0 -0
  28. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/GeoAlchemy2_dev.yml +0 -0
  29. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/MANIFEST.in +0 -0
  30. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/README.rst +0 -0
  31. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/RELEASE.rst +0 -0
  32. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/TEST.rst +0 -0
  33. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/Makefile +0 -0
  34. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_static/geoalchemy.png +0 -0
  35. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_static/geoalchemy.svg +0 -0
  36. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_static/geoalchemy_small.png +0 -0
  37. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_static/geoalchemy_small.svg +0 -0
  38. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_templates/sidebar-about.html +0 -0
  39. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_templates/sidebar-links.html +0 -0
  40. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_templates/sidebar-logo.html +0 -0
  41. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/LICENSE +0 -0
  42. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/README +0 -0
  43. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/flask/layout.html +0 -0
  44. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/flask/relations.html +0 -0
  45. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/flask/static/flasky.css_t +0 -0
  46. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/flask/static/small_flask.css +0 -0
  47. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/_themes/flask/theme.conf +0 -0
  48. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/admin.rst +0 -0
  49. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/alembic.rst +0 -0
  50. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/alembic_helpers.rst +0 -0
  51. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/changelog.rst +0 -0
  52. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/conf.py +0 -0
  53. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/core_tutorial.rst +0 -0
  54. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/elements.rst +0 -0
  55. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/index.rst +0 -0
  56. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/make.bat +0 -0
  57. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/migrate.rst +0 -0
  58. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/orm_tutorial.rst +0 -0
  59. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/shape.rst +0 -0
  60. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/spatial_functions.rst +0 -0
  61. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/spatial_operators.rst +0 -0
  62. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/spatialite_tutorial.rst +0 -0
  63. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/doc/types.rst +0 -0
  64. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/generate_type_stubs.py +0 -0
  65. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/__init__.py +0 -0
  66. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/_functions.py +0 -0
  67. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/_functions_helpers.py +0 -0
  68. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/__init__.py +0 -0
  69. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/dialects/__init__.py +0 -0
  70. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/dialects/common.py +0 -0
  71. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/dialects/geopackage.py +0 -0
  72. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/dialects/mysql.py +0 -0
  73. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/dialects/postgresql.py +0 -0
  74. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/admin/dialects/sqlite.py +0 -0
  75. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/alembic_helpers.py +0 -0
  76. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/comparator.py +0 -0
  77. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/exc.py +0 -0
  78. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/functions.py +0 -0
  79. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/functions.pyi +0 -0
  80. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/py.typed +0 -0
  81. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/shape.py +0 -0
  82. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/__init__.py +0 -0
  83. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/dialects/__init__.py +0 -0
  84. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/dialects/common.py +0 -0
  85. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/dialects/geopackage.py +0 -0
  86. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/dialects/mysql.py +0 -0
  87. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/types/dialects/postgresql.py +0 -0
  88. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/geoalchemy2/utils.py +0 -0
  89. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/pyproject.toml +0 -0
  90. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/requirements-doc.txt +0 -0
  91. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/requirements-mypy.txt +0 -0
  92. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/requirements-rtd.txt +0 -0
  93. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/requirements.txt +0 -0
  94. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/setup.cfg +0 -0
  95. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/setup.py +0 -0
  96. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/.dockerignore +0 -0
  97. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/.gitignore +0 -0
  98. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/Dockerfile +0 -0
  99. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/build.sh +0 -0
  100. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/helpers/entrypoint.sh +0 -0
  101. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/helpers/init_mysql.sh +0 -0
  102. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/helpers/init_postgres.sh +0 -0
  103. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/helpers/install_requirements.sh +0 -0
  104. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/test_container/run.sh +0 -0
  105. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/alembic_config/alembic.ini +0 -0
  106. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/conftest.py +0 -0
  107. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/data/spatialite_ge_4.sqlite +0 -0
  108. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/data/spatialite_geopackage.gpkg +0 -0
  109. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/data/spatialite_lt_4.sqlite +0 -0
  110. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/README.rst +0 -0
  111. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/__init__.py +0 -0
  112. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_decipher_raster.py +0 -0
  113. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_disable_wrapping.py +0 -0
  114. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_insert_raster.py +0 -0
  115. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_length_at_insert.py +0 -0
  116. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_orm_mapped_v2.py +0 -0
  117. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_raster_transform.py +0 -0
  118. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_specific_compilation.py +0 -0
  119. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_summarystatsagg.py +0 -0
  120. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/gallery/test_type_decorator.py +0 -0
  121. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/schema_fixtures.py +0 -0
  122. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_alembic_migrations.py +0 -0
  123. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_comparator.py +0 -0
  124. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_elements.py +0 -0
  125. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_functional_geopackage.py +0 -0
  126. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_functional_mysql.py +0 -0
  127. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_functional_postgresql.py +0 -0
  128. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_functions.py +0 -0
  129. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_pickle.py +0 -0
  130. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_shape.py +0 -0
  131. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tests/test_types.py +0 -0
  132. {geoalchemy2-0.15.1 → geoalchemy2-0.15.2}/tox.ini +0 -0
@@ -2,7 +2,7 @@ default_language_version:
2
2
  python: python3.8
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v4.5.0
5
+ rev: v4.6.0
6
6
  hooks:
7
7
  - id: check-added-large-files
8
8
  - id: check-case-conflict
@@ -17,11 +17,11 @@ repos:
17
17
  hooks:
18
18
  - id: isort
19
19
  - repo: https://github.com/psf/black
20
- rev: 24.3.0
20
+ rev: 24.4.2
21
21
  hooks:
22
22
  - id: black
23
23
  - repo: https://github.com/codespell-project/codespell
24
- rev: v2.2.6
24
+ rev: v2.3.0
25
25
  hooks:
26
26
  - id: codespell
27
27
  - repo: https://github.com/PyCQA/pydocstyle
@@ -31,7 +31,7 @@ repos:
31
31
  additional_dependencies: ["tomli"]
32
32
  exclude: "tests"
33
33
  - repo: https://github.com/PyCQA/flake8
34
- rev: 7.0.0
34
+ rev: 7.1.0
35
35
  hooks:
36
36
  - id: flake8
37
37
  ci:
@@ -1,6 +1,11 @@
1
1
  GeoAlchemy 2 Changelog
2
2
  ======================
3
3
 
4
+ 0.15.2
5
+ ------
6
+
7
+ * Fix: Can handle negative coordinates with Spatialite @adrien-berchet (#517)
8
+
4
9
  0.15.1
5
10
  ------
6
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GeoAlchemy2
3
- Version: 0.15.1
3
+ Version: 0.15.2
4
4
  Summary: Using SQLAlchemy with Spatial Databases
5
5
  Home-page: https://geoalchemy-2.readthedocs.io/en/stable/
6
6
  Author: Eric Lemoine
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GeoAlchemy2
3
- Version: 0.15.1
3
+ Version: 0.15.2
4
4
  Summary: Using SQLAlchemy with Spatial Databases
5
5
  Home-page: https://geoalchemy-2.readthedocs.io/en/stable/
6
6
  Author: Eric Lemoine
@@ -117,7 +117,7 @@ class WKTElement(_SpatialElement):
117
117
  """
118
118
 
119
119
  _REMOVE_SRID = re.compile("(SRID=([0-9]+); ?)?(.*)")
120
- SPLIT_WKT_PATTERN = re.compile(r"((SRID=\d+) *; *)?([\w ]+) *(\([\d\. ,\(\)]+\))")
120
+ SPLIT_WKT_PATTERN = re.compile(r"((SRID=\d+) *; *)?([\w ]+) *(\([-\d\. ,\(\)]+\))")
121
121
 
122
122
  geom_from: str = "ST_GeomFromText"
123
123
  geom_from_extended_version: str = "ST_GeomFromEWKT"
@@ -1,6 +1,7 @@
1
1
  """This module defines specific functions for SQLite dialect."""
2
2
 
3
3
  import re
4
+ import warnings
4
5
 
5
6
  from geoalchemy2.elements import RasterElement
6
7
  from geoalchemy2.elements import WKBElement
@@ -12,6 +13,10 @@ def format_geom_type(wkt, default_srid=None):
12
13
  """Format the Geometry type for SQLite."""
13
14
  match = re.match(WKTElement.SPLIT_WKT_PATTERN, wkt)
14
15
  if match is None:
16
+ warnings.warn(
17
+ "The given WKT could not be parsed by GeoAlchemy2, this could lead to undefined "
18
+ f"behavior with Z, M or ZM geometries or with incorrect SRID. The WKT string is: {wkt}"
19
+ )
15
20
  return wkt
16
21
  _, srid, geom_type, coords = match.groups()
17
22
  geom_type = geom_type.replace(" ", "")
@@ -5,8 +5,7 @@ import shutil
5
5
  import sys
6
6
 
7
7
  import pytest
8
- from packaging import version
9
- from pkg_resources import parse_version
8
+ from packaging.version import parse as parse_version
10
9
  from sqlalchemy import __version__ as SA_VERSION
11
10
  from sqlalchemy import create_engine
12
11
  from sqlalchemy import select as raw_select
@@ -30,9 +29,9 @@ class test_only_with_dialects:
30
29
 
31
30
  def get_postgis_major_version(bind):
32
31
  try:
33
- return version.parse(bind.execute(func.postgis_lib_version()).scalar()).major
32
+ return parse_version(bind.execute(func.postgis_lib_version()).scalar()).major
34
33
  except OperationalError:
35
- return version.parse("0").major
34
+ return parse_version("0").major
36
35
 
37
36
 
38
37
  def get_postgres_major_version(bind):
@@ -81,7 +80,7 @@ def skip_pypy(msg=None):
81
80
 
82
81
 
83
82
  def select(args):
84
- if version.parse(SA_VERSION) < version.parse("1.4"):
83
+ if parse_version(SA_VERSION) < parse_version("1.4"):
85
84
  return raw_select(args)
86
85
  else:
87
86
  return raw_select(*args)
@@ -445,6 +445,32 @@ class TestInsertionCore:
445
445
  assert srid == 4326
446
446
  assert row[1] == from_shape(Point(1, 1), srid=4326, extended=True)
447
447
 
448
+ def test_insert_negative_coords(self, conn, Poi, setup_tables, dialect_name):
449
+ conn.execute(
450
+ Poi.__table__.insert(),
451
+ [
452
+ {"geom": "SRID=4326;POINT(-1 1)"},
453
+ {"geom": WKTElement("POINT(-1 1)", srid=4326)},
454
+ {"geom": WKTElement("SRID=4326;POINT(-1 1)", extended=True)},
455
+ {"geom": from_shape(Point(-1, 1), srid=4326)},
456
+ {"geom": from_shape(Point(-1, 1), srid=4326, extended=True)},
457
+ ],
458
+ )
459
+
460
+ results = conn.execute(Poi.__table__.select())
461
+ rows = results.fetchall()
462
+
463
+ for row in rows:
464
+ assert isinstance(row[1], WKBElement)
465
+ wkt = conn.execute(row[1].ST_AsText()).scalar()
466
+ assert format_wkt(wkt) == "POINT(-1 1)"
467
+ srid = conn.execute(row[1].ST_SRID()).scalar()
468
+ assert srid == 4326
469
+ if dialect_name == "mysql":
470
+ assert row[1] == from_shape(Point(-1, 1), srid=4326)
471
+ else:
472
+ assert row[1] == from_shape(Point(-1, 1), srid=4326, extended=True)
473
+
448
474
 
449
475
  class TestSelectBindParam:
450
476
  @pytest.fixture
@@ -1,7 +1,9 @@
1
1
  import re
2
2
 
3
3
  import pytest
4
+ from shapely.geometry import GeometryCollection
4
5
  from shapely.geometry import LineString
6
+ from shapely.geometry import Point
5
7
  from sqlalchemy import CheckConstraint
6
8
  from sqlalchemy import Column
7
9
  from sqlalchemy import Integer
@@ -22,6 +24,7 @@ from geoalchemy2.elements import WKTElement
22
24
  from geoalchemy2.shape import from_shape
23
25
  from geoalchemy2.shape import to_shape
24
26
 
27
+ from . import format_wkt
25
28
  from . import select
26
29
  from . import skip_case_insensitivity
27
30
  from . import skip_pypy
@@ -310,6 +313,51 @@ class TestMiscellaneous:
310
313
  load_spatialite(conn.connection.dbapi_connection)
311
314
 
312
315
 
316
+ class TestInsertionCore:
317
+ @pytest.fixture
318
+ def GeomObject(self, base):
319
+ class GeomObject(base):
320
+ __tablename__ = "any_geom_object"
321
+ id = Column(Integer, primary_key=True)
322
+ geom = Column(Geometry(srid=4326))
323
+
324
+ return GeomObject
325
+
326
+ def test_insert_unparsable_WKT(self, conn, GeomObject, setup_tables, dialect_name):
327
+ with pytest.warns(
328
+ UserWarning,
329
+ match=(
330
+ "The given WKT could not be parsed by GeoAlchemy2, this could lead to undefined "
331
+ "behavior"
332
+ ),
333
+ ):
334
+ conn.execute(
335
+ GeomObject.__table__.insert(),
336
+ [
337
+ {"geom": "SRID=4326;GeometryCollection(POINT (-1 1),LINESTRING (2 2, 3 3))"},
338
+ ],
339
+ )
340
+
341
+ results = conn.execute(GeomObject.__table__.select())
342
+ rows = results.fetchall()
343
+
344
+ for row in rows:
345
+ assert isinstance(row[1], WKBElement)
346
+ wkt = conn.execute(row[1].ST_AsText()).scalar()
347
+ assert format_wkt(wkt) == "GEOMETRYCOLLECTION(POINT(-1 1),LINESTRING(2 2,3 3))"
348
+ srid = conn.execute(row[1].ST_SRID()).scalar()
349
+ assert srid == 4326
350
+ if dialect_name == "mysql":
351
+ extended = None
352
+ else:
353
+ extended = True
354
+ assert row[1] == from_shape(
355
+ GeometryCollection([Point(-1, 1), LineString([[2, 2], [3, 3]])]),
356
+ srid=4326,
357
+ extended=extended,
358
+ )
359
+
360
+
313
361
  class TestInsertionORM:
314
362
  @pytest.fixture
315
363
  def LocalPoint(self, base):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes