  
          self.assertEqual(bob.username, 'bob')
          self.assertEqual(bob._state.db, 'default')
  
          self.assertRaises(User.DoesNotExist, User.objects.using('other').get, username='bob')
  
          # That is... there is one user on each database
          self.assertEqual(User.objects.using('default').count(), 1)
          self.assertEqual(User.objects.using('other').count(), 1)
  
 
</s> remove         self.assertRaises(User.DoesNotExist, User.objects.using('default').get, username='alice')
 </s> add         with self.assertRaises(User.DoesNotExist):
            User.objects.using('default').get(username='alice') </s> remove             self.assertRaises(IndexError, poly.__getitem__, len(poly))
            self.assertRaises(IndexError, poly.__setitem__, len(poly), False)
            self.assertRaises(IndexError, poly.__getitem__, -1 * len(poly) - 1)
 </s> add             with self.assertRaises(IndexError):
                poly.__getitem__(len(poly))
            with self.assertRaises(IndexError):
                poly.__setitem__(len(poly), False)
            with self.assertRaises(IndexError):
                poly.__getitem__(-1 * len(poly) - 1) </s> remove         self.assertRaises(DatabaseError, self.column_classes, new_field.remote_field.through)
 </s> add         with self.assertRaises(DatabaseError):
            self.column_classes(new_field.remote_field.through) </s> remove         self.assertRaises(DatabaseError, self.column_classes, new_field.remote_field.through)
 </s> add         with self.assertRaises(DatabaseError):
            self.column_classes(new_field.remote_field.through) </s> remove             self.assertRaises(TypeError, SimpleView.as_view, **kwargs)
 </s> add             with self.assertRaises(TypeError):
                SimpleView.as_view(**kwargs)
        with self.assertRaises(User.DoesNotExist):
            User.objects.using('other').get(username='bob')
  
          self.assertEqual(bob.username, 'bob')
          self.assertEqual(bob._state.db, 'default')
  
        with self.assertRaises(User.DoesNotExist):
            User.objects.using('other').get(username='bob')
  
          # That is... there is one user on each database
          self.assertEqual(User.objects.using('default').count(), 1)
          self.assertEqual(User.objects.using('other').count(), 1)
  
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/multiple_database/tests.py