      def __init__(self, auth=False):
          self.is_authenticated = CallableBool(auth)
  
  
  class PermissionsCompositionTests(TestCase):
      def test_and_false(self):
          request = factory.get('/1', format='json')
          request.user = FakeUser(auth=False)
          composed_perm = permissions.IsAuthenticated & permissions.AllowAny
          assert composed_perm().has_permission(request, None) is False
 
</s> remove class FakeUser:
    def __init__(self, auth=False):
        self.is_authenticated = CallableBool(auth)
 </s> add class PermissionsCompositionTests(TestCase): </s> remove         request.user = FakeUser(auth=False)
 </s> add         request.user = AnonymousUser() </s> remove         request.user = FakeUser(auth=False)
 </s> add         request.user = AnonymousUser() </s> remove         request.user = FakeUser(auth=True)
 </s> add         request.user = self.user
      def __init__(self, auth=False):
          self.is_authenticated = CallableBool(auth)
  
  

      def test_and_false(self):
          request = factory.get('/1', format='json')
          request.user = FakeUser(auth=False)
          composed_perm = permissions.IsAuthenticated & permissions.AllowAny
          assert composed_perm().has_permission(request, None) is False
keep keep keep keep replace keep keep keep keep keep
 use actual user instead of fake user in permission composition test 
tests/test_permissions.py