mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 07:57:26 +03:00 
			
		
		
		
	Merge branch 'django-choices-translation' of https://github.com/Ian-Foote/graphene into fix_lazy_translated_choice
This commit is contained in:
		
						commit
						4936e40258
					
				|  | @ -1,5 +1,6 @@ | ||||||
| import pytest | import pytest | ||||||
| from django.db import models | from django.db import models | ||||||
|  | from django.utils.translation import ugettext_lazy as _ | ||||||
| from py.test import raises | from py.test import raises | ||||||
| 
 | 
 | ||||||
| import graphene | import graphene | ||||||
|  | @ -117,6 +118,21 @@ def test_field_with_choices_convert_enum(): | ||||||
|     assert graphene_type.__enum__.__members__['ENGLISH'].value == 'en' |     assert graphene_type.__enum__.__members__['ENGLISH'].value == 'en' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def test_field_with_choices_gettext(): | ||||||
|  |     field = models.CharField(help_text='Language', choices=( | ||||||
|  |         ('es', _('Spanish')), | ||||||
|  |         ('en', _('English')) | ||||||
|  |     )) | ||||||
|  | 
 | ||||||
|  |     class TranslatedModel(models.Model): | ||||||
|  |         language = field | ||||||
|  | 
 | ||||||
|  |         class Meta: | ||||||
|  |             app_label = 'test' | ||||||
|  | 
 | ||||||
|  |     convert_django_field_with_choices(field) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def test_should_float_convert_float(): | def test_should_float_convert_float(): | ||||||
|     assert_conversion(models.FloatField, graphene.Float) |     assert_conversion(models.FloatField, graphene.Float) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user