def _check_result(assert_result=True):
 (x, y, w, h) = gl.glGetParameter(gl.GL_VIEWPORT)
 data = gl.glReadPixels(x, y, w, h, gl.GL_RGB, gl.GL_UNSIGNED_BYTE)
 im = np.frombuffer(data, np.uint8)
 im.shape = (h, w, 3)
 pix1 = tuple(im[(int(((1 * h) / 4)), int(((1 * w) / 4)))])
 pix2 = tuple(im[(int(((3 * h) / 4)), int(((1 * w) / 4)))])
 pix3 = tuple(im[(int(((3 * h) / 4)), int(((3 * w) / 4)))])
 pix4 = tuple(im[(int(((1 * h) / 4)), int(((3 * w) / 4)))])
 if assert_result:
  assert_equal(pix1, (0, 0, 0))
  assert_equal(pix2, (255, 0, 0))
  assert_equal(pix3, (0, 255, 0))
  assert_equal(pix4, (0, 0, 255))

def _check_result ( assert_result = True ) : ( x , y , w , h ) = gl . glGetParameter ( gl . GL_VIEWPORT ) data = gl . glReadPixels ( x , y , w , h , gl . GL_RGB , gl . GL_UNSIGNED_BYTE ) im = np . frombuffer ( data , np . uint8 ) im . shape = ( h , w , 3 ) pix1 = tuple ( im [ ( int ( ( ( 1 * h ) / 4 ) ) , int ( ( ( 1 * w ) / 4 ) ) ) ] ) pix2 = tuple ( im [ ( int ( ( ( 3 * h ) / 4 ) ) , int ( ( ( 1 * w ) / 4 ) ) ) ] ) pix3 = tuple ( im [ ( int ( ( ( 3 * h ) / 4 ) ) , int ( ( ( 3 * w ) / 4 ) ) ) ] ) pix4 = tuple ( im [ ( int ( ( ( 1 * h ) / 4 ) ) , int ( ( ( 3 * w ) / 4 ) ) ) ] ) if assert_result : assert_equal ( pix1 , ( 0 , 0 , 0 ) ) assert_equal ( pix2 , ( 255 , 0 , 0 ) ) assert_equal ( pix3 , ( 0 , 255 , 0 ) ) assert_equal ( pix4 , ( 0 , 0 , 255 ) )
checks whether result is a valid api response .