def test_name_auto_generation(self):
    index = models.Index(fields=['author'])
    index.set_name_with_model(Book)
    self.assertEqual(index.name, 'model_index_author_0f5565_idx')
    index = models.Index(fields=['-author'])
    index.set_name_with_model(Book)
    self.assertEqual(index.name, 'model_index_author_708765_idx')
    long_field_index = models.Index(fields=['pages'])
    long_field_index.set_name_with_model(Book)
    self.assertEqual(long_field_index.name, 'model_index_page_co_69235a_idx')
    long_field_index.suffix = 'suff'
    msg = 'Index too long for multiple database support. Is self.suffix longer than 3 characters?'
    with self.assertRaisesMessage(AssertionError, msg):
        long_field_index.set_name_with_model(Book)
def test_name_auto_generation(self):
    index = models.Index(fields=['author'])
    index.set_name_with_model(Book)
    self.assertEqual(index.name, 'model_index_author_0f5565_idx')
    index = models.Index(fields=['-author'])
    index.set_name_with_model(Book)
    self.assertEqual(index.name, 'model_index_author_708765_idx')
    long_field_index = models.Index(fields=['pages'])
    long_field_index.set_name_with_model(Book)
    self.assertEqual(long_field_index.name, 'model_index_page_co_69235a_idx')
    long_field_index.suffix = 'suff'
    msg = 'Index too long for multiple database support. Is self.suffix longer than 3 characters?'
    with self.assertRaisesMessage(AssertionError, msg):
        long_field_index.set_name_with_model(Book)