django/tests/gis_tests/geos_tests/test_coordseq.py
David Smith 14fc2e9703
Some checks are pending
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
Improved consistency of GEOS error messages.
2025-07-21 22:23:29 -03:00

15 lines
551 B
Python

from django.contrib.gis.geos import LineString
from django.test import SimpleTestCase
class GEOSCoordSeqTest(SimpleTestCase):
def test_getitem(self):
coord_seq = LineString([(x, x) for x in range(2)]).coord_seq
for i in (0, 1):
with self.subTest(i):
self.assertEqual(coord_seq[i], (i, i))
for i in (-3, 10):
msg = f"Invalid GEOS Geometry index: {i}"
with self.subTest(i):
with self.assertRaisesMessage(IndexError, msg):
coord_seq[i]