def test_start_settlement_1(self): ''' Case A 题目用例,有促销,有优惠券 :return: ''' case_path = os.path.join(Config.test_data_path, 'case_A.txt') allinfo = deal_file(case_path) self.shcart.add_discount(allinfo[0]) self.shcart.add_goods(allinfo[1]) self.shcart.set_paydate(allinfo[2][0]) self.shcart.add_coupon(allinfo[3]) ret = self.shcart.start_settlement() self.assertEqual( ret, Decimal(3083.60).quantize(Decimal('0.00'), rounding=ROUND_HALF_UP))
def test_start_settlement_3(self): ''' Case 3 促销信息与结算日期不在同一天,不享受促销优惠 :return: ''' case_path = os.path.join(Config.test_data_path, 'case_3.txt') allinfo = deal_file(case_path) self.shcart.add_discount(allinfo[0]) self.shcart.add_goods(allinfo[1]) self.shcart.set_paydate(allinfo[2][0]) self.shcart.add_coupon(allinfo[3]) ret = self.shcart.start_settlement() ret = self.shcart.start_settlement() self.assertEqual( ret, Decimal(4043.00).quantize(Decimal('0.00'), rounding=ROUND_HALF_UP))