code: def test_fuzzybreaks():
      n = 10
      x = list(range(n))
      limits = min(x), max(x)
      # continuous scale
      cscale = scale_x_continuous(limits=limits)
      cscale.train(x)
  
      breaks = fuzzybreaks(cscale, bins=n - 1, right=True)
      assert breaks[0] <= limits[0]
      assert breaks[-1] >= limits[1]
      assert all(_x < b for _x, b in zip(x[1:-1], breaks[1:-1]))
  
      breaks = fuzzybreaks(cscale, bins=n - 1, right=False)
      assert breaks[0] <= limits[0]
      assert breaks[-1] >= limits[1]
      assert all(b < _x for _x, b in zip(x[1:-1], breaks[1:-1]))
  
      breaks = fuzzybreaks(cscale, binwidth=1, right=True)
      assert breaks[0] <= limits[0]
      assert breaks[-1] >= limits[1]
      assert all(_x < b for _x, b in zip(x[1:-1], breaks[1:-1]))
  
      # discrete scale
      x = list(range(1, n + 1))  # items are "labelled" 1 to n
      dscale = scale_x_discrete(limits=x)
      breaks = fuzzybreaks(dscale)
      # The breaks create bins centered on the limits
      assert list((breaks[:-1] + breaks[1:]) / 2) == x
  
imports: import numpy
  from plotnine.scales import scale_x_continuous, scale_x_discrete
  from plotnine.stats.binning import _adjust_breaks, breaks_from_bins, breaks_from_binwidth, fuzzybreaks
label_desc: Use image node_id 3 for calling a global function with example usage: test_fuzzybreaks() without return types