def setUp(self): self.parser = Parser(TestModel)
def setUp(self): qs = TestModel.objects.annotate( full_name=Concat('first_name', V(' '), 'last_name')) self.parser = Parser(qs)
def test_date_with_format(self): parser = Parser(TestModel, date_format='%d/%m/%Y') self.assertEquals(parser.parse('datefield="13/12/2018"'), Q(datefield=date(2018, 12, 13))) self.assertEquals(parser.parse('datefield=13/12/2018'), Q(datefield=date(2018, 12, 13)))
class BaseTest(TestCase): def setUp(self): self.parser = Parser(TestModel) def parse(self, query): return self.parser.parse(query)
def test_date_without_format(self): parser = Parser(TestModel) self.assertEquals(parser.parse('datefield="2018-12-13"'), Q(datefield=date(2018, 12, 13)))