示例#1
0
def test_get_chart_of_giving_handles_a_non_standard_amount():
    tip = ("foo", "bar", "5.37", True)
    expected = ( [[-1, 1, Decimal('5.37'), 1.0, Decimal('1')]]
               , 1.0, Decimal('5.37')
                )
    with testing.setup_tips(tip):
        actual = gittip.get_chart_of_giving('bar')
        assert actual == expected, actual
示例#2
0
def test_get_chart_of_giving_handles_a_tip():
    tip = ("foo", "bar", "3.00", True)
    expected = ( [[Decimal('3.00'), 1, Decimal('3.00'), 1.0, Decimal('1')]]
               , 1.0, Decimal('3.00')
                )
    with testing.setup_tips(tip):
        actual = gittip.get_chart_of_giving('bar')
        assert actual == expected, actual
示例#3
0
def test_get_chart_of_giving_ignores_missing_cc():
    tips = [ ("foo", "bar", "1.00", True)
           , ("baz", "bar", "3.00", None)
            ]
    expected = ( [[Decimal('1.00'), 1L, Decimal('1.00'), 1, Decimal('1')]]
               , 1.0, Decimal('1.00')
                )
    with testing.setup_tips(*tips):
        actual = gittip.get_chart_of_giving('bar')
        assert actual == expected, actual
示例#4
0
def test_get_chart_of_giving_handles_multiple_tips():
    tips = [ ("foo", "bar", "1.00", True)
           , ("baz", "bar", "3.00", True)
            ]
    expected = ( [ [Decimal('1.00'), 1L, Decimal('1.00'), 0.5, Decimal('0.25')]
                 , [Decimal('3.00'), 1L, Decimal('3.00'), 0.5, Decimal('0.75')]
                  ]
               , 2.0, Decimal('4.00')
                )
    with testing.setup_tips(*tips):
        actual = gittip.get_chart_of_giving('bar')
        assert actual == expected, actual
示例#5
0
def test_get_chart_of_giving_handles_no_tips():
    expected = ([], 0.0, Decimal('0.00'))
    with testing.setup_tips():
        actual = gittip.get_chart_of_giving('foo')
        assert actual == expected, actual