Exemple #1
0
 def testAnd(self):
     p = Qualifier('A')
     q = Qualifier('B')
     self.assertEqual((p.and_(q)).value,
                      'A and B')
     self.assertEqual((p&q).value,
                      'A and B')
Exemple #2
0
 def testOr(self):
     p = Qualifier('A')
     q = Qualifier('B')
     self.assertEqual((p.or_(q)).value,
                      'A or B')
     self.assertEqual((p|q).value,
                      'A or B')
Exemple #3
0
 def _halfTotal(self, whichHalf):
     qual = Qualifier()
     total = 0
     trans = self.transaction()
     movs = trans.search('Movement', (qual.operation == whichHalf) &
                         (qual.id == self.id))
     return sum([i.amount for i in movs])
Exemple #4
0
    def testAddEntryCredit(self):
        self.acEntry.credit(amount=self.amount, account=self.credit)
        qual = Qualifier()

        a = self.trans.search("Movement", qual.entry.number.equal(
                              self.acEntry.number))

        self.assertEqual(a[0].entry, self.acEntry)
        self.assertEqual(a[0].operation, 1)
        self.assertEqual(a[0].account, self.credit)
Exemple #5
0
    def testAddEntryDebit(self):
        """
        Checks if all the accounting entry has been made with the correct
        movements
        """
        self.acEntry.debit(amount=self.amount, account=self.debit)
        qual = Qualifier()

        a = self.trans.search("Movement", qual.entry.number.equal(self.acEntry.number))

        self.assertEqual(a[0].entry,self.acEntry)
        self.assertEqual(a[0].operation,0)
        self.assertEqual(a[0].account,self.debit)
Exemple #6
0
 def setUp(self):
     super(TestPointOfSale, self).setUp()
     self.pettyCashName = 'Piece of POS'
     self.pos = PointOfSale(name=self.pettyCashName)
     self.client = Client(subject=Person(name='Cacho', surname='Moo'))
     self.category = CustomerAccount(name='FonCyT')
     self.account = MovementAccount(name='Impuestos', code="1")
     self.subAccount = MovementAccount(name='IVA',
                                       code="11",
                                       parent=self.account)
     self.trans = Transaction()
     self.qual = Qualifier()
     self.trans.track(self.pos, self.category, self.account,
                      self.subAccount, self.client, self.client.subject)
     self.trans.save()
Exemple #7
0
 def testComposite(self):
     p = Qualifier().bar < 5
     q = Qualifier().foo > 3
     self.assertEqual((p&q).value, '(bar < 5) and (foo > 3)')
Exemple #8
0
 def testQualifierQualified(self):
     q = Qualifier().foo > 3
     self.assertRaises(AttributeError, lambda: q.foo)
Exemple #9
0
 def testMxDateTime(self):
     q = Qualifier()
     self.assertEqual((q.foo <= mx.DateTime.Date(2005,1,31)).value,
                      'foo <= "2005-01-31 00:00:00.00"')
Exemple #10
0
 def testString(self):
     q = Qualifier()
     self.assertEqual((q.foo <= '3').value,
                      'foo <= "3"')
Exemple #11
0
 def testLike(self):
     q = Qualifier()
     self.assertEqual((q.foo.like('meh*')).value,
                      'foo ilike "meh*"')
     self.assertEqual((q.foo ^ 'meh*').value,
                      'foo ilike "meh*"')
Exemple #12
0
 def testEqual(self):
     q = Qualifier()
     for p in q.foo.equal(3), q.foo == 3:
         self.assertEqual(p.value,
                          'foo == 3')
Exemple #13
0
 def testBinop(self):
     q = Qualifier()
     self.assertEqual(q.foo.binop(3, 'w00t').value,
                      'foo w00t 3')
Exemple #14
0
 def testB(self):
     q = Qualifier()
     self.assertEqual(q.foo.bar.value, 'foo.bar')
Exemple #15
0
 def testA(self):
     q = Qualifier()
     assert isinstance(q.foo, Qualifier)