equal
deleted
inserted
replaced
|
1 # -*- coding: utf-8 -*- |
|
2 import datetime |
|
3 |
|
4 from django.test import TestCase |
|
5 |
|
6 from models import Article, InternationalArticle |
|
7 |
|
8 class SimpleTests(TestCase): |
|
9 def test_basic(self): |
|
10 a = Article.objects.create( |
|
11 headline='Area man programs in Python', |
|
12 pub_date=datetime.datetime(2005, 7, 28) |
|
13 ) |
|
14 self.assertEqual(str(a), 'Area man programs in Python') |
|
15 self.assertEqual(repr(a), '<Article: Area man programs in Python>') |
|
16 |
|
17 def test_international(self): |
|
18 a = InternationalArticle.objects.create( |
|
19 headline=u'Girl wins €12.500 in lottery', |
|
20 pub_date=datetime.datetime(2005, 7, 28) |
|
21 ) |
|
22 # The default str() output will be the UTF-8 encoded output of __unicode__(). |
|
23 self.assertEqual(str(a), 'Girl wins \xe2\x82\xac12.500 in lottery') |