mirror of
https://github.com/django/django.git
synced 2024-12-23 09:36:06 +00:00
17 lines
706 B
Python
17 lines
706 B
Python
from datetime import datetime
|
|
|
|
from django.db.models import DateTimeField, Value
|
|
from django.db.models.lookups import YearLookup
|
|
from django.test import SimpleTestCase
|
|
|
|
|
|
class YearLookupTests(SimpleTestCase):
|
|
def test_get_bound_params(self):
|
|
look_up = YearLookup(
|
|
lhs=Value(datetime(2010, 1, 1, 0, 0, 0), output_field=DateTimeField()),
|
|
rhs=Value(datetime(2010, 1, 1, 23, 59, 59), output_field=DateTimeField()),
|
|
)
|
|
msg = 'subclasses of YearLookup must provide a get_bound_params() method'
|
|
with self.assertRaisesMessage(NotImplementedError, msg):
|
|
look_up.get_bound_params(datetime(2010, 1, 1, 0, 0, 0), datetime(2010, 1, 1, 23, 59, 59))
|