App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / tests / modeltests / str / tests.py
blob9f6cf7ad96af884df44c20327a5407cd0bd43174
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
4 import datetime
6 from django.test import TestCase
8 from .models import Article, InternationalArticle
11 class SimpleTests(TestCase):
12 def test_basic(self):
13 a = Article.objects.create(
14 headline='Area man programs in Python',
15 pub_date=datetime.datetime(2005, 7, 28)
17 self.assertEqual(str(a), 'Area man programs in Python')
18 self.assertEqual(repr(a), '<Article: Area man programs in Python>')
20 def test_international(self):
21 a = InternationalArticle.objects.create(
22 headline=u'Girl wins €12.500 in lottery',
23 pub_date=datetime.datetime(2005, 7, 28)
25 # The default str() output will be the UTF-8 encoded output of __unicode__().
26 self.assertEqual(str(a), 'Girl wins \xe2\x82\xac12.500 in lottery')