code: def test_stat_basics():
      class stat_abc(stat):
          DEFAULT_PARAMS = {"geom": "point", "position": "identity"}
          CREATES = {"fill"}
  
      class stat_efg(stat):
          DEFAULT_PARAMS = {"geom": "point", "position": "identity"}
          REQUIRED_AES = {"weight"}
          CREATES = {"fill"}
  
      gg = ggplot(aes(x="wt", y="mpg"), mtcars)
  
      # stat_abc has no _calculate method
      with pytest.raises(NotImplementedError):
          print(gg + stat_abc())
  
      # stat_efg requires 'weight' aesthetic
      with pytest.raises(PlotnineError):
          print(gg + stat_efg())
  
file_path: plotnine/tests/test_stat.py
imports: import numpy
  import pytest
  from plotnine import aes, geom_bar, ggplot
  from plotnine.data import mtcars
  from plotnine.exceptions import PlotnineError, PlotnineWarning
  from plotnine.geoms.geom import geom
  from plotnine.stats.stat import stat
label_desc: Use image node_id 1 for calling a global function with example usage: test_stat_basics() without return types