          self.assertNotIn('OUTER JOIN', str(c2.query))
  
      def test_distinct_not_implemented_checks(self):
          # distinct + annotate not allowed
          with self.assertRaises(NotImplementedError):
              Celebrity.objects.annotate(Max('id')).distinct('id')[0]
          with self.assertRaises(NotImplementedError):
              Celebrity.objects.distinct('id').annotate(Max('id'))[0]
  
          # However this check is done only when the query executes, so you
 
</s> remove         with self.assertRaises(NotImplementedError):
 </s> add         with self.assertRaisesMessage(NotImplementedError, msg): </s> remove         with self.assertRaises(NotImplementedError):
 </s> add         msg = 'aggregate() + distinct(fields) not implemented.'
        with self.assertRaisesMessage(NotImplementedError, msg): </s> remove             with self.assertRaises(NotImplementedError):
 </s> add             msg = 'Bilateral transformations on nested querysets are not supported.'
            with self.assertRaisesMessage(NotImplementedError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = 'The model Location is abstract, so it cannot be registered with admin.'
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         # "name" is treated as an iterable so the output is something like
        # "n, a, m, e" but the order isn't deterministic.
        with self.assertRaisesMessage(ValueError, self.msg % ''):
        msg = 'annotate() + distinct(fields) is not implemented.'
        with self.assertRaisesMessage(NotImplementedError, msg):
          self.assertNotIn('OUTER JOIN', str(c2.query))
  
      def test_distinct_not_implemented_checks(self):
          # distinct + annotate not allowed
        msg = 'annotate() + distinct(fields) is not implemented.'
        with self.assertRaisesMessage(NotImplementedError, msg):
              Celebrity.objects.annotate(Max('id')).distinct('id')[0]
          with self.assertRaises(NotImplementedError):
              Celebrity.objects.distinct('id').annotate(Max('id'))[0]
  
          # However this check is done only when the query executes, so you
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/distinct_on_fields/tests.py