code: def test_few_datapoints():
      data = pd.DataFrame(
          {"x": [1, 2, 2, 3, 3, 3], "z": list("abbccc")}
      )
  
      # Bandwidth not set
      p = (
          ggplot(data, aes("x", color="z"))
          + geom_density()
          + lims(x=(-3, 9))
      )
      with pytest.warns(PlotnineWarning) as record:
          p.draw_test()
  
      record = list(record)  # iterate more than 1 time
      assert any("e.g `bw=0.1`" in str(r.message) for r in record)
      assert any(
          "Groups with fewer than 2" in str(r.message) for r in record
      )
  
      p = (
          ggplot(data, aes("x", color="z"))
          + geom_density(bw=0.1)
          + lims(x=(0, 4))
      )
      assert p == "few_datapoints"
  
file_path: plotnine/tests/test_geom_density.py
imports: import numpy
  import pandas
  import pytest
  from plotnine import aes, geom_density, ggplot, lims
  from plotnine.exceptions import PlotnineWarning
label_desc: Use image node_id 5 for calling a global function with example usage: test_few_datapoints() without return types