Exemplo n.º 1
0
 def test_free(self):
     cases = ['free', 'FREE', 'frEe', '    frEE \t  \t']
     l = []
     for s in cases:
         l.extend(process_item_data({'name': 'jam', 'price': s}))
     assert(len(l) == len(cases))
     for item in l:
         assert(item.price == 0)
     for item in l:
         assert(item.name == 'jam')
Exemplo n.º 2
0
 def test_dollar_amt_4(self):
     cases = ['$3.29', '$39.95', '$0.', '  $278000.12   \t']
     l = []
     for s in cases:
         l.extend(process_item_data({'name': 'Just Beta Cheese', 'price': s}))
     assert(l[0].price == 329)
     assert(l[1].price == 3995)
     assert(l[2].price == 0)
     assert(l[3].price == 27800012)
     for item in l:
         assert(item.name == 'Just Beta Cheese')
Exemplo n.º 3
0
 def test_dollar_amt_3(self):
     cases = ['2.10', '4.72', '0.25', '\r\n  102.38   \t']
     l = []
     for s in cases:
         l.extend(process_item_data({'name': 'silveRware', 'price': s}))
     assert(l[0].price == 210)
     assert(l[1].price == 472)
     assert(l[2].price == 25)
     assert(l[3].price == 10238)
     for item in l:
         assert(item.name == 'silveRware')
Exemplo n.º 4
0
 def test_dollar_amt_2(self):
     cases = ['$1', '$14', '$0', ' \n\n\n $4201   \t']
     l = []
     for s in cases:
         l.extend(process_item_data({'name': 'Just Feta Cheese', 'price': s}))
     assert(l[0].price == 100)
     assert(l[1].price == 1400)
     assert(l[2].price == 0)
     assert(l[3].price == 420100)
     for item in l:
         assert(item.name == 'Just Feta Cheese')
Exemplo n.º 5
0
 def test_dollar_amt(self):
     cases = ['3', '4', '0', '               35   \t']
     l = []
     for s in cases:
         l.extend(process_item_data({'name': 'hum', 'price': s}))
     assert(l[0].price == 300)
     assert(l[1].price == 400)
     assert(l[2].price == 0)
     assert(l[3].price == 3500)
     for item in l:
         assert(item.name == 'hum')
Exemplo n.º 6
0
 def test_pizza(self):  # I love pizza
     cases = [
         '$5.29/Slice 0/Personal Pizza',
         '0/sLICE $0.98/personal PIZZA',
         '$10.10/slice $200.34/personal pizza' ]
     l = []
     for s in cases:
         l.extend(process_item_data({'name': 'Not Pizza-Pizza', 'price': s}))
     assert(l[0].price == 529)
     assert(l[1].price == 0)
     assert(l[2].price == 0)
     assert(l[3].price == 98)
     assert(l[4].price == 1010)
     assert(l[5].price == 20034)
     assert(l[0].name == 'Not Pizza-Pizza Slice')
     assert(l[1].name == 'Not Pizza-Pizza Personal Pizza')
     assert(l[2].name == 'Not Pizza-Pizza Slice')
     assert(l[3].name == 'Not Pizza-Pizza Personal Pizza')
     assert(l[4].name == 'Not Pizza-Pizza Slice')
     assert(l[5].name == 'Not Pizza-Pizza Personal Pizza')
Exemplo n.º 7
0
 def test_nothing(self):
     for s in ['nothing', 'NOTHING', 'nOthing', '  nothING\t\t\n']:
         l = process_item_data({'name': 'ham', 'price': s})
         assert(len(l) == 0)