Beispiel #1
0
 def test_height_range(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10","10", '-5', '-6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Height")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "10", '51', '51', "Prior"])
     self.assertEqual(R.cal(), "Invalid Height")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "10", '1', '1',"Xpress"])
     self.assertEqual(R.cal(), "Invalid Height")
Beispiel #2
0
 def test_length_is_digit(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", 'fre4545', '5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Length")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '0.432434', '5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Length")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '-0.432434', '5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Length")
Beispiel #3
0
 def test_length_range(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10","1000", '5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Length")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "0", '5', '6', "Prior"])
     self.assertEqual(R.cal(), "Invalid Length")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "-4", '5', '6',"Xpress"])
     self.assertEqual(R.cal(), "Invalid Length")
Beispiel #4
0
 def test_width_range(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "70","4", '5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Width")
     R = RateCalculator(["H2W1J5", "H2W1J5", "-2", "4", '5', '6', "Prior"])
     self.assertEqual(R.cal(), "Invalid Width")
     R = RateCalculator(["H2W1J5", "H2W1J5", "51", "4", '5', '6',"Xpress"])
     self.assertEqual(R.cal(), "Invalid Width")
Beispiel #5
0
 def test_weight_range(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "10", "5", "-6", "Regular"])
     self.assertEqual(R.cal(), "Invalid Weight")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "11", "50", "9996", "Prior"])
     self.assertEqual(R.cal(), "Invalid Weight")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", "33", "35", "60", "Xpress"])
     self.assertEqual(R.cal(), "Invalid Weight")
Beispiel #6
0
 def test_correct_post_type(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "3","4", '5', '6', "Xpress"])
     self.assertNotEqual(R.cal(),"Invalid Post Type: [Regular, Xpress, Prior]")
     R = RateCalculator(["H2W1J5", "H2W1J5", "3","4", '5', '6', "Prior"])
     self.assertNotEqual(R.cal(),"Invalid Post Type: [Regular, Xpress, Prior]")
     R = RateCalculator(["H2W1J5", "H2W1J5", "3","4", '5', '6', "Regular"])
     self.assertNotEqual(R.cal(),"Invalid Post Type: [Regular, Xpress, Prior]")
Beispiel #7
0
 def test_to_postal_code_format_wrong(self):
     R = RateCalculator(["H2W1G2",'H2W1fdsfG2','3','4','5','6','7'])
     self.assertEqual(R.cal(), "Invalid To: Postal Code")
     R = RateCalculator(["H2W1G2",'HEW1G2','3','4','5','6','7'])
     self.assertEqual(R.cal(), "Invalid To: Postal Code")
     R = RateCalculator(["H2W1G2",'H2W1G2FF','3','4','5','6','7'])
     self.assertEqual(R.cal(), "Invalid To: Postal Code")
Beispiel #8
0
 def test_postal_rate(self):
     R = RateCalculator(["H2W1J5", "A2W1K4", "10", '10', '10',"10", "Regular"])
     self.assertEqual(R.cal(), 10.10)
     R = RateCalculator(["H2W1J5", "A2W1K4", "30", '4', '37',"25", "Xpress"])
     self.assertEqual(R.cal(), 89.31)
     R = RateCalculator(["H2W1J5", "A2W1K4", "30", '4', '37',"25", "Prior"])
     self.assertEqual(R.cal(), 133.96)
Beispiel #9
0
 def test_from_postal_code_format_wrong(self):
     R = RateCalculator(["HeW1J5",'2','3','4','5','6','7'])
     self.assertEqual(R.cal(), "Invalid From: Postal Code")
     R = RateCalculator(["D2W155",'2','3','4','5','6','7'])
     self.assertEqual(R.cal(), "Invalid From: Postal Code")
     R = RateCalculator(["H2W145",'2','3','4','5','6','7'])
     self.assertEqual(R.cal(), "Invalid From: Postal Code")
Beispiel #10
0
 def test_weight_correct(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '10', '10',"10", "Regular"])
     self.assertNotEqual(R.cal(), "Invalid Weight")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '10', '10',"10", "Prior"])
     self.assertNotEqual(R.cal(), "Invalid Weight")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '10', '10',"10", "Xpress"])
     self.assertNotEqual(R.cal(), "Invalid Weight")
Beispiel #11
0
 def test_width_correct(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10","4", '5', '6', "Regular"])
     self.assertNotEqual(R.cal(), "Invalid Width")
     R = RateCalculator(["H2W1J5", "H2W1J5", "50", "4", '5', '6', "Prior"])
     self.assertNotEqual(R.cal(), "Invalid Width")
     R = RateCalculator(["H2W1J5", "H2W1J5", "40", "4", '5', '6',"Xpress"])
     self.assertNotEqual(R.cal(), "Invalid Width")
Beispiel #12
0
 def test_width_is_digit(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "0.4", "4", '5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Width")
     R = RateCalculator(["H2W1J5", "H2W1J5", "gfd34", "4",'5', '6', "Regular"])
     self.assertEqual(R.cal(), "Invalid Width")
Beispiel #13
0
 def test_no_args(self):
     R = RateCalculator([])
     self.assertEqual(R.cal(), "Usage: Python3 from_postal_code to_postal_code width length height weight post_type")
Beispiel #14
0
 def test_wrong_post_type(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "3","4", '5', '6', "fjkldsf"])
     self.assertEqual(R.cal(),"Invalid Post Type: [Regular, Xpress, Prior]")
Beispiel #15
0
 def test_len_to_postal_code_wrong(self):
     R = RateCalculator(["H2W1J5", "H2Wterer", '3','4','5','6','7'])
     self.assertEqual(R.cal(),"Invalid To: Postal Code")
     R = RateCalculator(["H2W1J5", "H2Wt", '3','4','5','6','7'])
     self.assertEqual(R.cal(),"Invalid To: Postal Code")
Beispiel #16
0
 def test_heigth_is_digit(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '10', "fdsfsd", "6", "Regular"])
     self.assertEqual(R.cal(), "Invalid Height")
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '10', "0.5", "6", "Regular"])
     self.assertEqual(R.cal(), "Invalid Height")
Beispiel #17
0
 def test_len_from_wrong(self):
     R = RateCalculator(["HeW1J534", '2','3','4','5','6','7'])
     self.assertEqual(R.cal(),"Invalid From: Postal Code")
     R = RateCalculator(["HeW4", '2','3','4','5','6','7'])
     self.assertEqual(R.cal(),"Invalid From: Postal Code")
Beispiel #18
0
 def test_more_args(self):
     R = RateCalculator(['1','2','3','4','5','6','7', '8'])
     self.assertEqual(R.cal(), "Usage: Python3 from_postal_code to_postal_code width length height weight post_type")
Beispiel #19
0
 def test_len_to_postal_code_correct(self):
     R = RateCalculator(["H2W1J5", "H2W1G2", '3','4','5','6','7'])
     self.assertNotEqual(R.cal(),"Invalid To: Postal Code")
Beispiel #20
0
 def test_from_postal_code_format_correct(self):
     R = RateCalculator(["H2W1J5",'2','3','4','5','6','7'])
     self.assertNotEqual(R.cal(), "Invalid From: Postal Code")
Beispiel #21
0
 def test_weight_is_digit(self):
     R = RateCalculator(["H2W1J5", "H2W1J5", "10", '10', '10',"0.565", "Regular"])
     self.assertEqual(R.cal(), "Invalid Weight")