code: def test_turnover():
      dts = pd.date_range("2010-01-01", periods=5)
      data = pd.DataFrame(index=dts, columns=["a", "b"], data=100)
  
      data["a"][dts[1]] = 105
      data["b"][dts[1]] = 95
  
      data["a"][dts[2]] = 110
      data["b"][dts[2]] = 90
  
      data["a"][dts[3]] = 115
      data["b"][dts[3]] = 85
  
      s = bt.Strategy(
          "s",
          [
              bt.algos.SelectAll(),
              bt.algos.WeighEqually(),
              bt.algos.Rebalance(),
          ],
      )
  
      t = bt.Backtest(
          s, data, commissions=lambda x, y: 0, progress_bar=False
      )
      res = bt.run(t)
  
      t = res.backtests["s"]
  
      # these numbers were (tediously) calculated in excel
      assert np.allclose(t.turnover[dts[0]], 0.0 / 1000000)
      assert np.allclose(t.turnover[dts[1]], 24985.0 / 1000000)
      assert np.allclose(t.turnover[dts[2]], 24970.0 / 997490)
      assert np.allclose(t.turnover[dts[3]], 25160.0 / 992455)
      assert np.allclose(t.turnover[dts[4]], 76100.0 / 1015285)
  
file_path: bt/tests/test_backtest.py
imports: from __future__ import division
  import numpy
  import pandas
  import pytest
  import random
  from unittest import mock
  import bt
label_desc: Use image node_id 6 for calling a global function with example usage: test_turnover() without return types