code: def test_dti_tz_localize_ambiguous_times(self, tz):
      # March 13, 2011, spring forward, skip from 2 AM to 3 AM
      dr = date_range(
          datetime(2011, 3, 13, 1, 30), periods=3, freq=offsets.Hour()
      )
      with pytest.raises(
          pytz.NonExistentTimeError, match="2011-03-13 02:30:00"
      ):
          dr.tz_localize(tz)
  
      # after dst transition, it works
      dr = date_range(
          datetime(2011, 3, 13, 3, 30),
          periods=3,
          freq=offsets.Hour(),
          tz=tz,
      )
  
      # November 6, 2011, fall back, repeat 2 AM hour
      dr = date_range(
          datetime(2011, 11, 6, 1, 30), periods=3, freq=offsets.Hour()
      )
      with pytest.raises(
          pytz.AmbiguousTimeError, match="Cannot infer dst time"
      ):
          dr.tz_localize(tz)
  
      # UTC is OK
      dr = date_range(
          datetime(2011, 3, 13),
          periods=48,
          freq=offsets.Minute(30),
          tz=pytz.utc,
      )
  
imports: from datetime import datetime, timedelta
  import dateutil.tz
  from dateutil.tz import gettz
  import numpy
  import pytest
  import pytz
  from pandas import DatetimeIndex, Timestamp, bdate_range, date_range, offsets, to_datetime
  import pandas._testing
label_desc: Use image node_id 7 for calling the TestTZLocalize obj's underlying member method code with example usage: obj.test_dti_tz_localize_ambiguous_times(tz) without return types