Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. from mathieu import fonctionDePaul as get_price
  2. BOOK1 = 1
  3. BOOK2 = 2
  4. BOOK3 = 3
  5. BOOK4 = 4
  6. BOOK5 = 5
  7.  
  8.  
  9. def test_get_price_empty_basket():
  10.     assert get_price([]) is 0
  11.  
  12.  
  13. def test_get_price_simple_book():
  14.     assert get_price([BOOK1]) == 8
  15.  
  16.  
  17. def test_get_price_book_for_discount1():
  18.     assert get_price([BOOK1, BOOK2]) == (16 * 0.95)
  19.  
  20.  
  21. def test_get_price_book_for_discount2():
  22.     assert get_price([BOOK1, BOOK2, BOOK3]) == (24 * 0.90)
  23.  
  24.  
  25. def test_get_price_book_for_discount3():
  26.     assert get_price([BOOK1, BOOK2, BOOK3, BOOK4]) == (32 * 0.80)
  27.  
  28.  
  29. def test_get_price_book_for_discount4():
  30.     assert get_price([BOOK1, BOOK2, BOOK3, BOOK4, BOOK5]) == (40 * 0.75)
  31.  
  32.  
  33. def test_get_price_book_for_mixed_discount1():
  34.     assert get_price([BOOK1, BOOK1, BOOK2]) == (16 * 0.95 + 8)
  35.  
  36.  
  37. def test_get_price_book_for_mixed_discount2():
  38.     assert get_price([BOOK1, BOOK1, BOOK1, BOOK2, BOOK2]) == 38.4
  39.  
  40.  
  41. def test_get_price_no_mixed():
  42.     assert get_price([BOOK1, BOOK1, BOOK1]) == 24
  43.  
  44.  
  45. def test_get_price_book_for_example():
  46.     assert get_price([BOOK1, BOOK1, BOOK2, BOOK2, BOOK3, BOOK3, BOOK4, BOOK5]) == 51.6
  47.  
  48.  
  49. def test_paul_is_teube():
  50.     assert get_price([1 for i in range(12)]) == 8 * 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement