  
      def test_basic_authentication_raises_error_if_user_not_active(self):
          from rest_framework import authentication
  
          class MockUser(object):
              is_active = False
          old_authenticate = authentication.authenticate
          authentication.authenticate = lambda **kwargs: MockUser()
          auth = authentication.BasicAuthentication()
          with pytest.raises(exceptions.AuthenticationFailed) as error:
 
</s> remove     class Option(object):
 </s> add     class Option: </s> remove     class EndOptionGroup(object):
 </s> add     class EndOptionGroup: </s> remove     if isinstance(auth, text_type):
 </s> add     if isinstance(auth, str): </s> remove class MockUser(object):
 </s> add class MockUser: </s> remove         view = super(APIView, cls).as_view(**initkwargs)
 </s> add         view = super().as_view(**initkwargs)
        class MockUser:
  
      def test_basic_authentication_raises_error_if_user_not_active(self):
          from rest_framework import authentication
  
        class MockUser:
              is_active = False
          old_authenticate = authentication.authenticate
          authentication.authenticate = lambda **kwargs: MockUser()
          auth = authentication.BasicAuthentication()
          with pytest.raises(exceptions.AuthenticationFailed) as error:
keep keep keep keep replace keep keep keep keep keep
 Dropped Python 2 compatibility. (#6615)

Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com> 
tests/authentication/test_authentication.py