Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from mathieu import fonctionDePaul as get_price
- BOOK1 = 1
- BOOK2 = 2
- BOOK3 = 3
- BOOK4 = 4
- BOOK5 = 5
- def test_get_price_empty_basket():
- assert get_price([]) is 0
- def test_get_price_simple_book():
- assert get_price([BOOK1]) == 8
- def test_get_price_book_for_discount1():
- assert get_price([BOOK1, BOOK2]) == (16 * 0.95)
- def test_get_price_book_for_discount2():
- assert get_price([BOOK1, BOOK2, BOOK3]) == (24 * 0.90)
- def test_get_price_book_for_discount3():
- assert get_price([BOOK1, BOOK2, BOOK3, BOOK4]) == (32 * 0.80)
- def test_get_price_book_for_discount4():
- assert get_price([BOOK1, BOOK2, BOOK3, BOOK4, BOOK5]) == (40 * 0.75)
- def test_get_price_book_for_mixed_discount1():
- assert get_price([BOOK1, BOOK1, BOOK2]) == (16 * 0.95 + 8)
- def test_get_price_book_for_mixed_discount2():
- assert get_price([BOOK1, BOOK1, BOOK1, BOOK2, BOOK2]) == 38.4
- def test_get_price_no_mixed():
- assert get_price([BOOK1, BOOK1, BOOK1]) == 24
- def test_get_price_book_for_example():
- assert get_price([BOOK1, BOOK1, BOOK2, BOOK2, BOOK3, BOOK3, BOOK4, BOOK5]) == 51.6
- def test_paul_is_teube():
- assert get_price([1 for i in range(12)]) == 8 * 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement