コード例 #1
0
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
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
0
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)
コード例 #6
0
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)