  class TestCustomTimezoneForDateTimeField(TestCase):
  
      @classmethod
      def setup_class(cls):
          cls.kolkata = pytz.timezone('Asia/Kolkata')
          cls.date_format = '%d/%m/%Y %H:%M'
  
      def test_should_render_date_time_in_default_timezone(self):
          field = serializers.DateTimeField(default_timezone=self.kolkata, format=self.date_format)
          dt = datetime.datetime(2018, 2, 8, 14, 15, 16, tzinfo=pytz.utc)
 
</s> remove         dt = datetime.datetime(2018, 2, 8, 14, 15, 16, tzinfo=pytz.utc)
 </s> add         dt = datetime.datetime(2018, 2, 8, 14, 15, 16, tzinfo=ZoneInfo("UTC")) </s> remove         cls.kolkata = pytz.timezone('Asia/Kolkata')
 </s> add         cls.kolkata = ZoneInfo('Asia/Kolkata') </s> remove @pytest.mark.skipif(pytz is None, reason='pytz not installed')
 </s> add  </s> remove         kolkata = pytz.timezone('Asia/Kolkata')
 </s> add         kolkata = ZoneInfo('Asia/Kolkata') </s> remove                 return timezone.make_aware(value, field_timezone)
 </s> add                 dt = timezone.make_aware(value, field_timezone)
                # When the resulting datetime is a ZoneInfo instance, it won't necessarily
                # throw given an invalid datetime, so we need to specifically check.
                if not valid_datetime(dt):
                    self.fail('make_aware', timezone=field_timezone)
                return dt
        cls.kolkata = ZoneInfo('Asia/Kolkata')
  class TestCustomTimezoneForDateTimeField(TestCase):
  
      @classmethod
      def setup_class(cls):
        cls.kolkata = ZoneInfo('Asia/Kolkata')
          cls.date_format = '%d/%m/%Y %H:%M'
  
      def test_should_render_date_time_in_default_timezone(self):
          field = serializers.DateTimeField(default_timezone=self.kolkata, format=self.date_format)
          dt = datetime.datetime(2018, 2, 8, 14, 15, 16, tzinfo=pytz.utc)
keep keep keep keep replace keep keep keep keep keep
 Use ZoneInfo as primary source of timezone data (#8924)

* Use ZoneInfo as primary source of timezone data

* Update tests/test_fields.py

---------

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com> 
tests/test_fields.py