| 1 |
from django.db.backends.sqlite3._functions import ( |
| 2 |
_sqlite_date_trunc, |
| 3 |
_sqlite_datetime_trunc, |
| 4 |
_sqlite_time_trunc, |
| 5 |
) |
| 6 |
from django.test import SimpleTestCase |
| 7 |
|
| 8 |
|
| 9 |
class FunctionTests(SimpleTestCase): |
| 10 |
def test_sqlite_date_trunc(self): |
| 11 |
msg = "Unsupported lookup type: 'unknown-lookup'" |
| 12 |
with self.assertRaisesMessage(ValueError, msg): |
| 13 |
_sqlite_date_trunc("unknown-lookup", "2005-08-11", None, None) |
| 14 |
|
| 15 |
def test_sqlite_datetime_trunc(self): |
| 16 |
msg = "Unsupported lookup type: 'unknown-lookup'" |
| 17 |
with self.assertRaisesMessage(ValueError, msg): |
| 18 |
_sqlite_datetime_trunc("unknown-lookup", "2005-08-11 1:00:00", None, None) |
| 19 |
|
| 20 |
def test_sqlite_time_trunc(self): |
| 21 |
msg = "Unsupported lookup type: 'unknown-lookup'" |
| 22 |
with self.assertRaisesMessage(ValueError, msg): |
| 23 |
_sqlite_time_trunc("unknown-lookup", "2005-08-11 1:00:00", None, None) |