'Test the custom ``django_date_trunc method``, in particular against
fields which clash with strings passed to it (e.g. \'year\') - see
#12818__.
__: http://code.djangoproject.com/ticket/12818'

def test_django_date_trunc(self):

    updated = datetime.datetime(2010, 2, 20)
    models.SchoolClass.objects.create(year=2009, last_updated=updated)
    years = models.SchoolClass.objects.dates(u'last_updated', u'year')
    self.assertEqual(list(years), [datetime.date(2010, 1, 1)])
