code: def test_calc_sharpe(df):
      x = pd.Series()
      assert np.isnan(x.calc_sharpe())
  
      r = df.to_returns()
  
      res = r.calc_sharpe()
      assert np.allclose(res, r.mean() / r.std())
  
      res = r.calc_sharpe(rf=0.05, nperiods=252)
      drf = ffn.deannualize(0.05, 252)
      ar = r - drf
      assert np.allclose(res, ar.mean() / ar.std() * np.sqrt(252))
  
imports: import ffn
  import pandas
  import numpy
  from pytest import fixture
  from numpy.testing import assert_almost_equal
label_desc: Use image node_id 37 for calling a global function with example usage: test_calc_sharpe(df) without return types