code: def test_symmetry(self):
      # Make sure the number of points added on the way towards the
      # boundary is similar to the number of points added on the way away
      # from the boundary.
  
      # Identify all the contiguous sets of non-boundary points.
      xy = np.array(self.multi_polygon.geoms[0].exterior.coords)
      boundary = np.logical_or(xy[:, 1] == 90, xy[:, 1] == -90)
      regions = (boundary[1:] != boundary[:-1]).cumsum()
      regions = np.insert(regions, 0, 0)
  
      # For each region, check if the number of increasing steps is roughly
      # equal to the number of decreasing steps.
      for i in range(int(boundary[0]), regions.max(), 2):
          indices = np.where(regions == i)
          x = xy[indices, 0]
          delta = np.diff(x)
          num_incr = np.count_nonzero(delta > 0)
          num_decr = np.count_nonzero(delta < 0)
          assert abs(num_incr - num_decr) < 3, "Too much asymmetry."
  
imports: import numpy
  import pytest
  import shapely.geometry
  import shapely.wkt
  import cartopy.crs
label_desc: Use image node_id 4 for calling the TestQuality obj's underlying member method code with example usage: obj.test_symmetry() without return types