mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Thanks Vinay Sajip for the support of his django3 branch and Jannis Leidel for the review.
		
			
				
	
	
		
			27 lines
		
	
	
		
			898 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			898 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|  # -*- coding: utf-8 -*-
 | |
| from __future__ import absolute_import, unicode_literals
 | |
| 
 | |
| import datetime
 | |
| 
 | |
| from django.test import TestCase
 | |
| 
 | |
| from .models import Article, InternationalArticle
 | |
| 
 | |
| 
 | |
| class SimpleTests(TestCase):
 | |
|     def test_basic(self):
 | |
|         a = Article.objects.create(
 | |
|             headline=b'Area man programs in Python',
 | |
|             pub_date=datetime.datetime(2005, 7, 28)
 | |
|         )
 | |
|         self.assertEqual(str(a), b'Area man programs in Python')
 | |
|         self.assertEqual(repr(a), b'<Article: Area man programs in Python>')
 | |
| 
 | |
|     def test_international(self):
 | |
|         a = InternationalArticle.objects.create(
 | |
|             headline='Girl wins €12.500 in lottery',
 | |
|             pub_date=datetime.datetime(2005, 7, 28)
 | |
|         )
 | |
|         # The default str() output will be the UTF-8 encoded output of __unicode__().
 | |
|         self.assertEqual(str(a), b'Girl wins \xe2\x82\xac12.500 in lottery')
 |