          request.user = self.user
          composed_perm = permissions.IsAuthenticated | permissions.AllowAny
          assert composed_perm().has_permission(request, None) is True
  
      def test_several_levels(self):
          request = factory.get('/1', format='json')
          request.user = self.user
          composed_perm = (
              permissions.IsAuthenticated &
              permissions.IsAuthenticated &
 
</s>
    def test_not_false(self):
        request = factory.get('/1', format='json')
        request.user = AnonymousUser()
        composed_perm = ~permissions.IsAuthenticated
        assert composed_perm().has_permission(request, None) is True

    def test_not_true(self):
        request = factory.get('/1', format='json')
        request.user = self.user
        composed_perm = ~permissions.AllowAny
        assert composed_perm().has_permission(request, None) is False

    def test_several_levels_without_negation(self):
          request.user = self.user
          composed_perm = permissions.IsAuthenticated | permissions.AllowAny
          assert composed_perm().has_permission(request, None) is True
  
    def test_not_false(self):
        request = factory.get('/1', format='json')
        request.user = AnonymousUser()
        composed_perm = ~permissions.IsAuthenticated
        assert composed_perm().has_permission(request, None) is True

    def test_not_true(self):
        request = factory.get('/1', format='json')
        request.user = self.user
        composed_perm = ~permissions.AllowAny
        assert composed_perm().has_permission(request, None) is False

    def test_several_levels_without_negation(self):
          request = factory.get('/1', format='json')
          request.user = self.user
          composed_perm = (
              permissions.IsAuthenticated &
              permissions.IsAuthenticated &
keep keep keep keep replace keep keep keep keep keep
 Add negation ~ operator to permissions composition (#6361)
tests/test_permissions.py