code: def test_location_event_position(x, y):
      # LocationEvent should cast its x and y arguments to int unless it is None.
      fig, ax = plt.subplots()
      canvas = FigureCanvasBase(fig)
      event = LocationEvent("test_event", canvas, x, y)
      if x is None:
          assert event.x is None
      else:
          assert event.x == int(x)
          assert isinstance(event.x, int)
      if y is None:
          assert event.y is None
      else:
          assert event.y == int(y)
          assert isinstance(event.y, int)
      if x is not None and y is not None:
          assert re.match(
              f"x={ax.format_xdata(x)} +y={ax.format_ydata(y)}",
              ax.format_coord(x, y),
          )
          ax.fmt_xdata = ax.fmt_ydata = lambda x: "foo"
          assert re.match("x=foo +y=foo", ax.format_coord(x, y))
  
imports: import re
  from matplotlib import path, transforms
  from matplotlib.backend_bases import FigureCanvasBase, KeyEvent, LocationEvent, MouseButton, MouseEvent, NavigationToolbar2, RendererBase
  from matplotlib.backend_tools import RubberbandBase
  from matplotlib.figure import Figure
  from matplotlib.testing._markers import needs_pgf_xelatex
  import matplotlib.pyplot
  import numpy
  import pytest
label_desc: Use image node_id 7 for calling a global function with example usage: test_location_event_position(x, y) without return types