def test_buy_contract_total_value_with_customer(fixtures): # Buy contract with a Car car_contract = BuyContract(vehicle=fixtures.car, customer=fixtures.customer, monthly_payments=6) assert round(car_contract.total_value(), 2) == 22986.72 truck_contract = BuyContract(vehicle=fixtures.truck, customer=fixtures.customer, monthly_payments=12) assert round(truck_contract.total_value(), 2) == 52580.48 bike_contract = BuyContract(vehicle=fixtures.bike, customer=fixtures.customer, monthly_payments=36) assert round(bike_contract.total_value(), 2) == 27141.84
def test_buy_contract_monthly_value_with_customer(fixtures): # Buy contract with a Car car_contract = BuyContract(vehicle=fixtures.car, customer=fixtures.customer, monthly_payments=6) assert round(car_contract.monthly_value(), 2) == 3831.12 truck_contract = BuyContract(vehicle=fixtures.truck, customer=fixtures.customer, monthly_payments=12) assert round(truck_contract.monthly_value(), 2) == 4381.71 bike_contract = BuyContract(vehicle=fixtures.bike, customer=fixtures.customer, monthly_payments=36) assert round(bike_contract.monthly_value(), 2) == 753.94
def test_buy_contract_creation(fixtures): car_contract = BuyContract(vehicle=fixtures.car, customer=fixtures.customer, monthly_payments=6) assert car_contract.vehicle == fixtures.car assert car_contract.customer == fixtures.customer assert car_contract.monthly_payments == 6 truck_contract = BuyContract(vehicle=fixtures.truck, customer=fixtures.customer, monthly_payments=12) assert truck_contract.vehicle == fixtures.truck assert truck_contract.customer == fixtures.customer assert truck_contract.monthly_payments == 12 bike_contract = BuyContract(vehicle=fixtures.bike, customer=fixtures.customer, monthly_payments=36) assert bike_contract.vehicle == fixtures.bike assert bike_contract.customer == fixtures.customer assert bike_contract.monthly_payments == 36
def test_buy_contract_total_value_with_employee(): car_contract = BuyContract(vehicle=car, customer=employee, monthly_payments=6) car_contract.total_value() == approx(20688.04, rel=1e-5) car_contract.monthly_value() == approx(3448, rel=1e-5) truck_contract = BuyContract(vehicle=truck, customer=employee, monthly_payments=12) assert truck_contract.total_value() == approx(47322.43, rel=1e-5) assert truck_contract.monthly_value() == approx(3943.53, rel=1e-5) bike_contract = BuyContract(vehicle=bike, customer=employee, monthly_payments=36) assert bike_contract.total_value() == approx(24427.65, rel=1e-5) assert bike_contract.monthly_value() == approx(678.54, rel=1e-5)
def test_buy_contract_total_value_with_customer(): car_contract = BuyContract(vehicle=car, customer=customer, monthly_payments=6) assert car_contract.total_value() == approx(22986.72, rel=1e-5) assert car_contract.monthly_value() == approx(3831.12, rel=1e-5) truck_contract = BuyContract(vehicle=truck, customer=customer, monthly_payments=12) assert truck_contract.total_value() == approx(52580.47, rel=1e-5) assert truck_contract.monthly_value() == approx(4381.70, rel=1e-5) bike_contract = BuyContract(vehicle=bike, customer=customer, monthly_payments=36) assert bike_contract.total_value() == approx(27141.84, rel=1e-5) assert bike_contract.monthly_value() == approx(753.94, rel=1e-5)
def test_buy_contract_with_employees(fixtures): car_contract = BuyContract(vehicle=fixtures.car, customer=fixtures.employee, monthly_payments=6) assert round(car_contract.total_value(), 2) == 20688.05 assert round(car_contract.monthly_value(), 2) == 3448.01 truck_contract = BuyContract(vehicle=fixtures.truck, customer=fixtures.employee, monthly_payments=12) assert round(truck_contract.total_value(), 2) == 47322.43 assert round(truck_contract.monthly_value(), 2) == 3943.54 bike_contract = BuyContract(vehicle=fixtures.bike, customer=fixtures.employee, monthly_payments=36) assert round(bike_contract.total_value(), 2) == 24427.66 assert round(bike_contract.monthly_value(), 2) == 678.55
def test_buy_contract_total_value_with_employee(self): car_contract = BuyContract( vehicle=self.car, customer=self.employee, monthly_payments=6) self.assertAlmostEqual(car_contract.total_value(), 20688.04, places=1) self.assertAlmostEqual(car_contract.monthly_value(), 3448, places=1) truck_contract = BuyContract( vehicle=self.truck, customer=self.employee, monthly_payments=12) self.assertAlmostEqual( truck_contract.total_value(), 47322.43, places=2) self.assertAlmostEqual( truck_contract.monthly_value(), 3943.53, places=1) bike_contract = BuyContract( vehicle=self.bike, customer=self.employee, monthly_payments=36) self.assertAlmostEqual( bike_contract.total_value(), 24427.65, places=1) self.assertAlmostEqual( bike_contract.monthly_value(), 678.54, places=1)
def test_buy_contract_total_value_with_customer(self): car_contract = BuyContract( vehicle=self.car, customer=self.customer, monthly_payments=6) self.assertAlmostEqual(car_contract.total_value(), 22986.72, places=3) self.assertAlmostEqual(car_contract.monthly_value(), 3831.12, places=3) truck_contract = BuyContract( vehicle=self.truck, customer=self.customer, monthly_payments=12) self.assertAlmostEqual( truck_contract.total_value(), 52580.47, places=1) self.assertAlmostEqual( truck_contract.monthly_value(), 4381.70, places=1) bike_contract = BuyContract( vehicle=self.bike, customer=self.customer, monthly_payments=36) self.assertAlmostEqual( bike_contract.total_value(), 27141.84, places=2) self.assertAlmostEqual( bike_contract.monthly_value(), 753.94, places=2)
def test_buy_contract_total_value_with_employee(fixtures): car_contract = BuyContract(vehicle=fixtures.car, customer=fixtures.employee, monthly_payments=6) assert almost_equal(car_contract.total_value(), 20688.04, places=1) assert almost_equal(car_contract.monthly_value(), 3448, places=1) truck_contract = BuyContract(vehicle=fixtures.truck, customer=fixtures.employee, monthly_payments=12) assert almost_equal(truck_contract.total_value(), 47322.43, places=2) assert almost_equal(truck_contract.monthly_value(), 3943.53, places=1) bike_contract = BuyContract(vehicle=fixtures.bike, customer=fixtures.employee, monthly_payments=36) assert almost_equal(bike_contract.total_value(), 24427.65, places=1) assert almost_equal(bike_contract.monthly_value(), 678.54, places=1)
def test_buy_contract_total_value_with_customer(fixtures): car_contract = BuyContract(vehicle=fixtures.car, customer=fixtures.customer, monthly_payments=6) assert almost_equal(car_contract.total_value(), 22986.72, places=3) assert almost_equal(car_contract.monthly_value(), 3831.12, places=3) truck_contract = BuyContract(vehicle=fixtures.truck, customer=fixtures.customer, monthly_payments=12) assert almost_equal(truck_contract.total_value(), 52580.47, places=1) assert almost_equal(truck_contract.monthly_value(), 4381.70, places=1) bike_contract = BuyContract(vehicle=fixtures.bike, customer=fixtures.customer, monthly_payments=36) assert almost_equal(bike_contract.total_value(), 27141.84, places=2) assert almost_equal(bike_contract.monthly_value(), 753.94, places=2)