1. from django.contrib.gis.geos import LineString
    
  2. from django.test import SimpleTestCase
    
  3. 
    
  4. 
    
  5. class GEOSCoordSeqTest(SimpleTestCase):
    
  6.     def test_getitem(self):
    
  7.         coord_seq = LineString([(x, x) for x in range(2)]).coord_seq
    
  8.         for i in (0, 1):
    
  9.             with self.subTest(i):
    
  10.                 self.assertEqual(coord_seq[i], (i, i))
    
  11.         for i in (-3, 10):
    
  12.             msg = "invalid GEOS Geometry index: %s" % i
    
  13.             with self.subTest(i):
    
  14.                 with self.assertRaisesMessage(IndexError, msg):
    
  15.                     coord_seq[i]