def test_prep_hit_full_in_rounded_case(): payday = Payday(gittip.db) actual = payday._prep_hit(Decimal('5.00')) expected = ( 1000 , u'Charging %s 1000 cents ($9.32 [rounded up from $5.00] + ' u'$0.68 fee = $10.00) on %s ... ' , Decimal('10.00') , Decimal('0.68') ) assert actual == expected, actual
def test_prep_hit_basically_works(): payday = Payday(gittip.db) actual = payday._prep_hit(Decimal('20.00')) expected = ( 2110 , u'Charging %s 2110 cents ($20.00 + $1.10 fee = $21.10) on %s ' u'... ' , Decimal('21.10') , Decimal('1.10') ) assert actual == expected, actual
def test_prep_hit_full_in_rounded_case(): payday = Payday(gittip.db) actual = payday._prep_hit(Decimal('5.00')) expected = ( 1000 , u'Charging %s 1000 cents ($9.32 [rounded up from $5.00] + ' u'$0.68 fee = $10.00) on %s ... ' , Decimal('10.00') , Decimal('0.68') ) assert actual == expected, actual
def test_prep_hit_basically_works(): payday = Payday(gittip.db) actual = payday._prep_hit(Decimal('20.00')) expected = ( 2110 , u'Charging %s 2110 cents ($20.00 + $1.10 fee = $21.10) on %s ' u'... ' , Decimal('21.10') , Decimal('1.10') ) assert actual == expected, actual
def prep(amount): """Given a dollar amount as a string, return a 3-tuple. The return tuple is like the one returned from _prep_hit, but with the second value, a log message, removed. """ typecheck(amount, unicode) payday = Payday(gittip.db) out = list(payday._prep_hit(Decimal(amount))) out = [out[0]] + out[2:] return tuple(out)
def prep(amount): """Given a dollar amount as a string, return a 3-tuple. The return tuple is like the one returned from _prep_hit, but with the second value, a log message, removed. """ typecheck(amount, unicode) payday = Payday(gittip.db) out = list(payday._prep_hit(Decimal(amount))) out = [out[0]] + out[2:] return tuple(out)