Loading tests/modeltests/str/models.py +1 −20 Original line number Diff line number Diff line Loading @@ -31,22 +31,3 @@ class InternationalArticle(models.Model): def __unicode__(self): return self.headline No newline at end of file __test__ = {'API_TESTS':ur""" # Create an Article. >>> from datetime import datetime >>> a = Article(headline='Area man programs in Python', pub_date=datetime(2005, 7, 28)) >>> a.save() >>> str(a) 'Area man programs in Python' >>> a <Article: Area man programs in Python> >>> a1 = InternationalArticle(headline=u'Girl wins €12.500 in lottery', pub_date=datetime(2005, 7, 28)) # The default str() output will be the UTF-8 encoded output of __unicode__(). >>> str(a1) 'Girl wins \xe2\x82\xac12.500 in lottery' """} tests/modeltests/str/tests.py 0 → 100644 +23 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- import datetime from django.test import TestCase from models import Article, InternationalArticle class SimpleTests(TestCase): def test_basic(self): a = Article.objects.create( headline='Area man programs in Python', pub_date=datetime.datetime(2005, 7, 28) ) self.assertEqual(str(a), 'Area man programs in Python') self.assertEqual(repr(a), '<Article: Area man programs in Python>') def test_international(self): a = InternationalArticle.objects.create( headline=u'Girl wins €12.500 in lottery', pub_date=datetime.datetime(2005, 7, 28) ) # The default str() output will be the UTF-8 encoded output of __unicode__(). self.assertEqual(str(a), 'Girl wins \xe2\x82\xac12.500 in lottery') No newline at end of file Loading
tests/modeltests/str/models.py +1 −20 Original line number Diff line number Diff line Loading @@ -31,22 +31,3 @@ class InternationalArticle(models.Model): def __unicode__(self): return self.headline No newline at end of file __test__ = {'API_TESTS':ur""" # Create an Article. >>> from datetime import datetime >>> a = Article(headline='Area man programs in Python', pub_date=datetime(2005, 7, 28)) >>> a.save() >>> str(a) 'Area man programs in Python' >>> a <Article: Area man programs in Python> >>> a1 = InternationalArticle(headline=u'Girl wins €12.500 in lottery', pub_date=datetime(2005, 7, 28)) # The default str() output will be the UTF-8 encoded output of __unicode__(). >>> str(a1) 'Girl wins \xe2\x82\xac12.500 in lottery' """}
tests/modeltests/str/tests.py 0 → 100644 +23 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- import datetime from django.test import TestCase from models import Article, InternationalArticle class SimpleTests(TestCase): def test_basic(self): a = Article.objects.create( headline='Area man programs in Python', pub_date=datetime.datetime(2005, 7, 28) ) self.assertEqual(str(a), 'Area man programs in Python') self.assertEqual(repr(a), '<Article: Area man programs in Python>') def test_international(self): a = InternationalArticle.objects.create( headline=u'Girl wins €12.500 in lottery', pub_date=datetime.datetime(2005, 7, 28) ) # The default str() output will be the UTF-8 encoded output of __unicode__(). self.assertEqual(str(a), 'Girl wins \xe2\x82\xac12.500 in lottery') No newline at end of file