mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Added test case for #3908
This commit is contained in:
		
							parent
							
								
									3ea1fe61a0
								
							
						
					
					
						commit
						b6adfab9b2
					
				
							
								
								
									
										21
									
								
								tests/test_exceptions.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								tests/test_exceptions.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
from __future__ import unicode_literals
 | 
			
		||||
 | 
			
		||||
from django.test import TestCase
 | 
			
		||||
from django.utils.translation import ugettext_lazy as _
 | 
			
		||||
 | 
			
		||||
from rest_framework.exceptions import _force_text_recursive
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ExceptionTestCase(TestCase):
 | 
			
		||||
 | 
			
		||||
    def test_force_text_recursive(self):
 | 
			
		||||
 | 
			
		||||
        s = "sfdsfggiuytraetfdlklj"
 | 
			
		||||
        self.assertEqual(_force_text_recursive(_(s)), s)
 | 
			
		||||
        self.assertEqual(type(_force_text_recursive(_(s))), type(s))
 | 
			
		||||
 | 
			
		||||
        self.assertEqual(_force_text_recursive({'a': _(s)})['a'], s)
 | 
			
		||||
        self.assertEqual(type(_force_text_recursive({'a': _(s)})['a']), type(s))
 | 
			
		||||
 | 
			
		||||
        self.assertEqual(_force_text_recursive([[_(s)]])[0][0], s)
 | 
			
		||||
        self.assertEqual(type(_force_text_recursive([[_(s)]])[0][0]), type(s))
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user