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(), [
24 self
.assertQuerysetEqual(
25 a
.articles_from_same_day_2(), [
31 self
.assertQuerysetEqual(
32 b
.articles_from_same_day_1(), [
33 "Area man programs in Python",
37 self
.assertQuerysetEqual(
38 b
.articles_from_same_day_2(), [
39 "Area man programs in Python",