Пример #1
0
 def test_balance(self):
     balance = self.parse("BALANCES;")
     select = qc.transform_balances(balance)
     self.assertEqual(
         qp.Select([
             qp.Target(qp.Column('account'), None),
             qp.Target(qp.Function('sum', [qp.Column('position')]), None),
         ], None, None, self.group_by, self.order_by, None, None, None,
                   None), select)
Пример #2
0
 def test_balance_with_units_and_from(self):
     balance = self.parse("BALANCES AT cost FROM year = 2014;")
     select = qc.transform_balances(balance)
     self.assertEqual(
         qp.Select([
             qp.Target(qp.Column('account'), None),
             qp.Target(
                 qp.Function(
                     'sum', [qp.Function('cost', [qp.Column('position')])]),
                 None),
         ],
                   qp.From(qp.Equal(qp.Column('year'), qp.Constant(2014)),
                           None, None, None), None, self.group_by,
                   self.order_by, None, None, None, None), select)