import pytest

from bokeh.charts.stats import Bins
from bokeh.models import ColumnDataSource


@pytest.fixture
def ds(test_data):
    return ColumnDataSource(test_data.auto_data)


def test_explicit_bin_count(ds):
    b = Bins(source=ds, column='mpg', bin_count=2)
    assert len(b.bins) == 2


def test_auto_bin_count(ds):
    b = Bins(source=ds, column='mpg', bin_count=2)
    assert len(b.bins) == 2
import pytest

from bokeh.charts.stats import Bins
from bokeh.models import ColumnDataSource


@pytest.fixture
def ds(test_data):
    return ColumnDataSource(test_data.auto_data)


def test_explicit_bin_count(ds):
    b = Bins(source=ds, column='mpg', bin_count=2)
    assert len(b.bins) == 2


def test_auto_bin_count(ds):
    b = Bins(source=ds, column='mpg')
    assert len(b.bins) == 12

Add auto binning test to stats.
Add auto binning test to stats.

  import pytest
  
  from bokeh.charts.stats import Bins
  from bokeh.models import ColumnDataSource
  
  
  @pytest.fixture
  def ds(test_data):
      return ColumnDataSource(test_data.auto_data)
  
  
  def test_explicit_bin_count(ds):
      b = Bins(source=ds, column='mpg', bin_count=2)
      assert len(b.bins) == 2
  
  
  def test_auto_bin_count(ds):
-     b = Bins(source=ds, column='mpg', bin_count=2)
+     b = Bins(source=ds, column='mpg')
-     assert len(b.bins) == 2
+     assert len(b.bins) == 12
+ 
Add auto binning test to stats.
## Code Before:
import pytest

from bokeh.charts.stats import Bins
from bokeh.models import ColumnDataSource


@pytest.fixture
def ds(test_data):
    return ColumnDataSource(test_data.auto_data)


def test_explicit_bin_count(ds):
    b = Bins(source=ds, column='mpg', bin_count=2)
    assert len(b.bins) == 2


def test_auto_bin_count(ds):
    b = Bins(source=ds, column='mpg', bin_count=2)
    assert len(b.bins) == 2
## Instruction:
Add auto binning test to stats.
## Code After:
import pytest

from bokeh.charts.stats import Bins
from bokeh.models import ColumnDataSource


@pytest.fixture
def ds(test_data):
    return ColumnDataSource(test_data.auto_data)


def test_explicit_bin_count(ds):
    b = Bins(source=ds, column='mpg', bin_count=2)
    assert len(b.bins) == 2


def test_auto_bin_count(ds):
    b = Bins(source=ds, column='mpg')
    assert len(b.bins) == 12
