code: def test_repair_100x_random_weekly_preSplit(self):
      # PNL.L has a stock-split in 2022. Sometimes requesting data before 2022 is not split-adjusted.
  
      tkr = "PNL.L"
      dat = yf.Ticker(tkr, session=self.session)
      tz_exchange = dat.fast_info["timezone"]
  
      data_cols = ["Low", "High", "Open", "Close", "Adj Close"]
      df = _pd.DataFrame(
          data={
              "Open": [400, 398, 392.5, 417],
              "High": [421, 425, 419, 420.5],
              "Low": [400, 380.5, 376.5, 396],
              "Close": [410, 409.5, 402, 399],
              "Adj Close": [393.91, 393.43, 386.22, 383.34],
              "Volume": [3232600, 3773900, 10835000, 4257900],
          },
          index=_pd.to_datetime(
              [
                  _dt.date(2020, 3, 30),
                  _dt.date(2020, 3, 23),
                  _dt.date(2020, 3, 16),
                  _dt.date(2020, 3, 9),
              ]
          ),
      )
      df = df.sort_index()
      # Simulate data missing split-adjustment:
      df[data_cols] *= 100.0
      df["Volume"] *= 0.01
      #
      df.index.name = "Date"
      # Create 100x errors:
      df_bad = df.copy()
      df_bad.loc["2020-03-30", "Close"] *= 100
      df_bad.loc["2020-03-23", "Low"] *= 100
      df_bad.loc["2020-03-09", "Open"] *= 100
      df.index = df.index.tz_localize(tz_exchange)
      df_bad.index = df_bad.index.tz_localize(tz_exchange)
  
      df_repaired = dat._fix_unit_random_mixups(
          df_bad, "1wk", tz_exchange, prepost=False
      )
  
      # First test - no errors left
      for c in data_cols:
          try:
              self.assertTrue(
                  _np.isclose(df_repaired[c], df[c], rtol=1e-2).all()
              )
          except AssertionError:
              print("Mismatch in column", c)
              print("- df_repaired:")
              print(df_repaired[c])
              print("- answer:")
              print(df[c])
              raise
  
      # Second test - all differences should be either ~1x or ~100x
      ratio = df_bad[data_cols].values / df[data_cols].values
      ratio = ratio.round(2)
      # - round near-100 ratio to 100:
      f = ratio > 90
      ratio[f] = (ratio[f] / 10).round().astype(
          int
      ) * 10  # round ratio to nearest 10
      # - now test
      f_100 = ratio == 100
      f_1 = ratio == 1
      self.assertTrue((f_100 | f_1).all())
  
      self.assertTrue("Repaired?" in df_repaired.columns)
      self.assertFalse(df_repaired["Repaired?"].isna().any())
  
imports: from .context import yfinance
  from .context import session_gbl
  import unittest
  import os
  import datetime
  import pytz
  import numpy
  import pandas
label_desc: Use image node_id 5 for calling the TestPriceRepair obj's underlying member method code with example usage: obj.test_repair_100x_random_weekly_preSplit() without return types