Пример #1
0
 def test_journal(self):
     journal = self.parse("JOURNAL;")
     select = qc.transform_journal(journal)
     self.assertEqual(
         qp.Select([
             qp.Target(qp.Column('date'), None),
             qp.Target(qp.Column('flag'), None),
             qp.Target(qp.Function('maxwidth', [qp.Column('payee'),
                                                qp.Constant(48)]), None),
             qp.Target(qp.Function('maxwidth', [qp.Column('narration'),
                                                qp.Constant(80)]), None),
             qp.Target(qp.Column('account'), None),
             qp.Target(qp.Column('position'), None),
             qp.Target(qp.Column('balance'), None),
         ],
              None, None, None, None, None, None, None, None),
         select)
Пример #2
0
 def test_journal_with_account_and_from(self):
     journal = self.parse("JOURNAL 'liabilities' FROM year = 2014;")
     select = qc.transform_journal(journal)
     self.assertEqual(
         qp.Select([
             qp.Target(qp.Column('date'), None),
             qp.Target(qp.Column('flag'), None),
             qp.Target(qp.Function('maxwidth', [qp.Column('payee'),
                                                qp.Constant(48)]), None),
             qp.Target(qp.Function('maxwidth', [qp.Column('narration'),
                                                qp.Constant(80)]), None),
             qp.Target(qp.Column('account'), None),
             qp.Target(qp.Column('position'), None),
             qp.Target(qp.Column('balance'), None),
         ],
              qp.From(qp.Equal(qp.Column('year'), qp.Constant(2014)), None, None, None),
                  qp.Match(qp.Column('account'), qp.Constant('liabilities')),
                  None, None, None, None, None, None),
         select)