mirror of
https://github.com/django/django.git
synced 2024-12-24 01:55:49 +00:00
7b2f2e74ad
Thanks Tim Graham and Simon Charette for the reviews.
17 lines
382 B
Python
17 lines
382 B
Python
from datetime import datetime
|
|
|
|
from django.test import TestCase
|
|
|
|
from .models import Article
|
|
|
|
|
|
class DefaultTests(TestCase):
|
|
def test_field_defaults(self):
|
|
a = Article()
|
|
now = datetime.now()
|
|
a.save()
|
|
|
|
self.assertIsInstance(a.id, int)
|
|
self.assertEqual(a.headline, "Default headline")
|
|
self.assertLess((now - a.pub_date).seconds, 5)
|