

def test_translatedfieldsmodel_str(self):
    'Test converting TranslatedFieldsModel to string'
    missing_language_code = 'xx'
    obj = SimpleModel.objects.create(tr_title='Something')
    translation = obj.translations.get()
    translation.language_code = missing_language_code
    translation.save()
    try:
        translation_as_str = str(obj.translations.get())
    except KeyError:
        self.fail('Converting translation to string raises KeyError')
    self.assertEqual(translation_as_str, missing_language_code)

dataset/ETHPy150Open edoburu/django-parler/parler/tests/test_model_attributes.py ModelAttributeTests.test_translatedfieldsmodel_str/original