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
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
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
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
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