code: def test_gen_drawdown_table(
      self,
      px,
      expected_peak,
      expected_valley,
      expected_recovery,
      expected_duration,
  ):
      rets = px.pct_change().iloc[1:]
  
      drawdowns = timeseries.gen_drawdown_table(rets, top=1)
      self.assertTrue(
          pd.isnull(drawdowns.loc[0, "Peak date"])
      ) if expected_peak is None else self.assertEqual(
          drawdowns.loc[0, "Peak date"], expected_peak
      )
      self.assertTrue(
          pd.isnull(drawdowns.loc[0, "Valley date"])
      ) if expected_valley is None else self.assertEqual(
          drawdowns.loc[0, "Valley date"], expected_valley
      )
      self.assertTrue(
          pd.isnull(drawdowns.loc[0, "Recovery date"])
      ) if expected_recovery is None else self.assertEqual(
          drawdowns.loc[0, "Recovery date"], expected_recovery
      )
      self.assertTrue(
          pd.isnull(drawdowns.loc[0, "Duration"])
      ) if expected_duration is None else self.assertEqual(
          drawdowns.loc[0, "Duration"], expected_duration
      )
  
imports: from __future__ import division
  import os
  from unittest import TestCase
  from nose_parameterized import parameterized
  from numpy.testing import assert_allclose, assert_almost_equal
  from pandas.util.testing import assert_series_equal
  import numpy
  import pandas
  from ..None import timeseries
  from pyfolio.utils import to_utc, to_series
  import gzip
label_desc: Use image node_id 4 for calling the TestDrawdown obj's underlying member method code with example usage: obj.test_gen_drawdown_table(px, expected_peak, expected_valley, expected_recovery, expected_duration) without return types