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')
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')
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])
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)
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)
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()
def testComposite(self): p = Qualifier().bar < 5 q = Qualifier().foo > 3 self.assertEqual((p&q).value, '(bar < 5) and (foo > 3)')
def testQualifierQualified(self): q = Qualifier().foo > 3 self.assertRaises(AttributeError, lambda: q.foo)
def testMxDateTime(self): q = Qualifier() self.assertEqual((q.foo <= mx.DateTime.Date(2005,1,31)).value, 'foo <= "2005-01-31 00:00:00.00"')
def testString(self): q = Qualifier() self.assertEqual((q.foo <= '3').value, 'foo <= "3"')
def testLike(self): q = Qualifier() self.assertEqual((q.foo.like('meh*')).value, 'foo ilike "meh*"') self.assertEqual((q.foo ^ 'meh*').value, 'foo ilike "meh*"')
def testEqual(self): q = Qualifier() for p in q.foo.equal(3), q.foo == 3: self.assertEqual(p.value, 'foo == 3')
def testBinop(self): q = Qualifier() self.assertEqual(q.foo.binop(3, 'w00t').value, 'foo w00t 3')
def testB(self): q = Qualifier() self.assertEqual(q.foo.bar.value, 'foo.bar')
def testA(self): q = Qualifier() assert isinstance(q.foo, Qualifier)