PageRenderTime 424ms CodeModel.GetById 121ms app.highlight 2ms RepoModel.GetById 128ms app.codeStats 1ms

/tests/modeltests/str/tests.py

https://code.google.com/p/mango-py/
Python | 23 lines | 17 code | 4 blank | 2 comment | 0 complexity | 1d436557063bda7b62a416ab51330817 MD5 | raw file
 1 # -*- coding: utf-8 -*-
 2import datetime
 3
 4from django.test import TestCase
 5
 6from models import Article, InternationalArticle
 7
 8class 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 รข&#x201A;?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')