      def tearDown(self):
          compat.django.VERSION = self.original_django_version
          compat.transaction = self.original_transaction
  
      def test_total_seconds(self):
          class MockTimedelta(object):
              days = 1
              seconds = 1
              microseconds = 100
          timedelta = MockTimedelta()
          expected = (timedelta.days * 86400.0) + float(timedelta.seconds) + (timedelta.microseconds / 1000000.0)
          assert compat.total_seconds(timedelta) == expected
  
      def test_set_rollback_for_transaction_in_managed_mode(self):
          class MockTransaction(object):
              called_rollback = False
              called_leave_transaction_management = False
  
 
</s> remove             return six.text_type(total_seconds(obj))
 </s> add             return six.text_type(obj.total_seconds()) </s> remove from rest_framework.compat import coreapi, total_seconds
 </s> add from rest_framework.compat import coreapi </s> remove def total_seconds(timedelta):
    # TimeDelta.total_seconds() is only available in Python 2.7
    if hasattr(timedelta, 'total_seconds'):
        return timedelta.total_seconds()
    else:
        return (timedelta.days * 86400.0) + float(timedelta.seconds) + (timedelta.microseconds / 1000000.0)


 </s> add 
      def tearDown(self):
          compat.django.VERSION = self.original_django_version
          compat.transaction = self.original_transaction
  









      def test_set_rollback_for_transaction_in_managed_mode(self):
          class MockTransaction(object):
              called_rollback = False
              called_leave_transaction_management = False
  
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Drop compat wrapper for TimeDelta.total_seconds() (#5577)

TimeDelta.total_seconds() was introduced in Python 2.7 and 3.2. It is
available on all supported Python versions.

https://docs.python.org/2/library/datetime.html#datetime.timedelta.total_seconds
https://docs.python.org/3/library/datetime.html#datetime.timedelta.total_seconds 
tests/test_compat.py