          """
          self.assertEqual(Employee.objects.get(pk=123), self.dan)
          self.assertEqual(Employee.objects.get(pk=456), self.fran)
  
          self.assertRaises(
              Employee.DoesNotExist,
              lambda: Employee.objects.get(pk=42)
          )
  
          # Use the name of the primary key, rather than pk.
          self.assertEqual(Employee.objects.get(employee_code=123), self.dan)
  
      def test_pk_attributes(self):
 
</s> remove         self.assertRaises(AttributeError, lambda: e.id)
 </s> add         with self.assertRaises(AttributeError):
            e.id </s> remove         self.assertRaises(
            FieldError,
            lambda: Book.objects.all().aggregate(num_authors=Count('foo'))
        )
 </s> add         with self.assertRaises(FieldError):
            Book.objects.all().aggregate(num_authors=Count('foo')) </s> remove         self.assertRaises(
            DatabaseError,
            lambda: list(Author.objects.all()),
        )
 </s> add         with self.assertRaises(DatabaseError):
            list(Author.objects.all()) </s> remove         self.assertRaises(
            ValueError,
            Book.objects.all().annotate,
            Avg('authors__age'), authors__age__avg=Avg('authors__age')
        )
 </s> add         with self.assertRaises(ValueError):
            Book.objects.all().annotate(Avg('authors__age'), authors__age__avg=Avg('authors__age')) </s> remove         self.assertRaises(
            FieldError,
            lambda: Book.objects.all().annotate(num_authors=Count('authors__id')).aggregate(Max('foo'))
        )
 </s> add         with self.assertRaises(FieldError):
            Book.objects.all().annotate(num_authors=Count('authors__id')).aggregate(Max('foo'))
        with self.assertRaises(Employee.DoesNotExist):
            Employee.objects.get(pk=42)
          """
          self.assertEqual(Employee.objects.get(pk=123), self.dan)
          self.assertEqual(Employee.objects.get(pk=456), self.fran)
  
        with self.assertRaises(Employee.DoesNotExist):
            Employee.objects.get(pk=42)
        with self.assertRaises(Employee.DoesNotExist):
            Employee.objects.get(pk=42)
        with self.assertRaises(Employee.DoesNotExist):
            Employee.objects.get(pk=42)
        with self.assertRaises(Employee.DoesNotExist):
            Employee.objects.get(pk=42)
  
          # Use the name of the primary key, rather than pk.
          self.assertEqual(Employee.objects.get(employee_code=123), self.dan)
  
      def test_pk_attributes(self):
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/custom_pk/tests.py