code: def test_bounded_impl_near_boundaries(self):
      cal = bounded_holiday_calendar.BoundedHolidayCalendar(
          weekend_mask=dates.WeekendMask.SATURDAY_SUNDAY,
          start_year=2017,
          end_year=2022,
      )
  
      def assert_roll_raises(roll_convention, date):
          with self.assertRaises(tf.errors.InvalidArgumentError):
              self.evaluate(
                  cal.roll_to_business_day(date, roll_convention).year()
              )
  
      def assert_rolls_to(roll_convention, date, expected_date):
          rolled = cal.roll_to_business_day(date, roll_convention)
          self.assertAllEqual(rolled.ordinal(), expected_date.ordinal())
  
      date = dates.dates_from_tuples([(2022, 12, 31)])  # Saturday
      preceding = dates.dates_from_tuples([(2022, 12, 30)])
      with self.subTest("following_upper_bound"):
          assert_roll_raises(
              dates.BusinessDayConvention.FOLLOWING, date
          )
      with self.subTest("preceding_upper_bound"):
          assert_rolls_to(
              dates.BusinessDayConvention.PRECEDING, date, preceding
          )
      with self.subTest("modified_following_upper_bound"):
          assert_rolls_to(
              dates.BusinessDayConvention.MODIFIED_FOLLOWING,
              date,
              preceding,
          )
      with self.subTest("modified_preceding_upper_bound"):
          assert_rolls_to(
              dates.BusinessDayConvention.MODIFIED_PRECEDING,
              date,
              preceding,
          )
  
      date = dates.dates_from_tuples([(2017, 1, 1)])  # Sunday
      following = dates.dates_from_tuples([(2017, 1, 2)])
  
      with self.subTest("following_lower_bound"):
          assert_rolls_to(
              dates.BusinessDayConvention.FOLLOWING, date, following
          )
      with self.subTest("preceding_lower_bound"):
          assert_roll_raises(
              dates.BusinessDayConvention.PRECEDING, date
          )
      with self.subTest("modified_following_lower_bound"):
          assert_rolls_to(
              dates.BusinessDayConvention.MODIFIED_FOLLOWING,
              date,
              following,
          )
      with self.subTest("modified_preceding_lower_bound"):
          assert_rolls_to(
              dates.BusinessDayConvention.MODIFIED_PRECEDING,
              date,
              following,
          )
  
imports: import datetime
  import functools
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tf_quant_finance.datetime import bounded_holiday_calendar
  from tf_quant_finance.datetime import test_data
  from tf_quant_finance.datetime import unbounded_holiday_calendar
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 12 for calling the HolidayCalendarTest obj's underlying member method code with example usage: obj.test_bounded_impl_near_boundaries() without return types