Revision created by MOE tool push_codebase.
[gae.git] / python / lib / django_1_3 / tests / modeltests / custom_methods / tests.py
blob90a7f0da293f92c4483aecf97b11acaea4417519
1 from datetime import date
3 from django.test import TestCase
5 from models import Article
8 class MethodsTests(TestCase):
9 def test_custom_methods(self):
10 a = Article.objects.create(
11 headline="Area man programs in Python", pub_date=date(2005, 7, 27)
13 b = Article.objects.create(
14 headline="Beatles reunite", pub_date=date(2005, 7, 27)
17 self.assertFalse(a.was_published_today())
18 self.assertQuerysetEqual(
19 a.articles_from_same_day_1(), [
20 "Beatles reunite",
22 lambda a: a.headline,
24 self.assertQuerysetEqual(
25 a.articles_from_same_day_2(), [
26 "Beatles reunite",
28 lambda a: a.headline
31 self.assertQuerysetEqual(
32 b.articles_from_same_day_1(), [
33 "Area man programs in Python",
35 lambda a: a.headline,
37 self.assertQuerysetEqual(
38 b.articles_from_same_day_2(), [
39 "Area man programs in Python",
41 lambda a: a.headline