          # Person with the same id and country_id
          membership = Membership.objects.create(
              membership_country_id=self.usa.id, person_id=self.jane.id, group_id=self.cia.id)
  
          self.assertRaises(Person.DoesNotExist, getattr, membership, 'person')
  
      def test_reverse_query_returns_correct_result(self):
          # Creating a valid membership because it has the same country has the person
          Membership.objects.create(
              membership_country_id=self.usa.id, person_id=self.bob.id, group_id=self.cia.id)
 
</s> remove         self.assertRaises(InvalidSessionKey,
                          self.backend()._key_to_file, "a\\b\\c")
 </s> add         with self.assertRaises(InvalidSessionKey):
            self.backend()._key_to_file("a\\b\\c") </s> remove         self.assertRaises(FieldError, Restaurant.objects.filter, supplier__name="foo")
 </s> add         with self.assertRaises(FieldError):
            Restaurant.objects.filter(supplier__name="foo") </s> remove         self.assertRaises(AttributeError, set_session_key, self.session)
 </s> add         with self.assertRaises(AttributeError):
            set_session_key(self.session) </s> remove         self.assertRaises(ImproperlyConfigured, self.backend)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.backend() </s> remove         self.assertRaises(TypeError, City.objects.svg, precision='foo')
 </s> add         with self.assertRaises(TypeError):
            City.objects.svg(precision='foo')
        with self.assertRaises(Person.DoesNotExist):
            getattr(membership, 'person')
          # Person with the same id and country_id
          membership = Membership.objects.create(
              membership_country_id=self.usa.id, person_id=self.jane.id, group_id=self.cia.id)
  
        with self.assertRaises(Person.DoesNotExist):
            getattr(membership, 'person')
  
      def test_reverse_query_returns_correct_result(self):
          # Creating a valid membership because it has the same country has the person
          Membership.objects.create(
              membership_country_id=self.usa.id, person_id=self.bob.id, group_id=self.cia.id)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/foreign_object/tests.py