mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			426 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			426 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from datetime import datetime
 | 
						|
 | 
						|
from django.test import TestCase
 | 
						|
from django.utils import six
 | 
						|
 | 
						|
from .models import Article
 | 
						|
 | 
						|
 | 
						|
class DefaultTests(TestCase):
 | 
						|
    def test_field_defaults(self):
 | 
						|
        a = Article()
 | 
						|
        now = datetime.now()
 | 
						|
        a.save()
 | 
						|
 | 
						|
        self.assertIsInstance(a.id, six.integer_types)
 | 
						|
        self.assertEqual(a.headline, "Default headline")
 | 
						|
        self.assertTrue((now - a.pub_date).seconds < 5)
 |