def test_lease_contract_monthly_value_with_customer(fixtures): car_contract = LeaseContract(vehicle=fixtures.car, customer=fixtures.customer, length_in_months=12) assert round(car_contract.monthly_value(), 2) == 1980.0 truck_contract = LeaseContract(vehicle=fixtures.truck, customer=fixtures.customer, length_in_months=24) assert round(truck_contract.monthly_value(), 2) == 2070.28 bike_contract = LeaseContract(vehicle=fixtures.bike, customer=fixtures.customer, length_in_months=36) assert round(bike_contract.monthly_value(), 2) == 565.28
def test_lease_contract_total_value_with_customer(fixtures): car_contract = LeaseContract(vehicle=fixtures.car, customer=fixtures.customer, length_in_months=12) assert round(car_contract.total_value(), 2) == 23760.0 truck_contract = LeaseContract(vehicle=fixtures.truck, customer=fixtures.customer, length_in_months=24) assert round(truck_contract.total_value(), 2) == 49686.67 bike_contract = LeaseContract(vehicle=fixtures.bike, customer=fixtures.customer, length_in_months=36) assert round(bike_contract.total_value(), 2) == 20350
def test_lease_contract_creation(fixtures): car_contract = LeaseContract(vehicle=fixtures.car, customer=fixtures.customer, length_in_months=12) assert car_contract.vehicle == fixtures.car assert car_contract.customer == fixtures.customer assert car_contract.length_in_months == 12 truck_contract = LeaseContract(vehicle=fixtures.truck, customer=fixtures.customer, length_in_months=24) assert truck_contract.vehicle == fixtures.truck assert truck_contract.customer == fixtures.customer assert truck_contract.length_in_months == 24 bike_contract = LeaseContract(vehicle=fixtures.bike, customer=fixtures.customer, length_in_months=36) assert bike_contract.vehicle == fixtures.bike assert bike_contract.customer == fixtures.customer assert bike_contract.length_in_months == 36
def test_lease_contract_total_value_with_customer(): car_contract = LeaseContract(vehicle=car, customer=customer, length_in_months=12) assert car_contract.total_value() == approx(23760.0, rel=1e-4) assert car_contract.monthly_value() == approx(1980.0, rel=1e-4) truck_contract = LeaseContract(vehicle=truck, customer=customer, length_in_months=24) assert truck_contract.total_value() == approx(49686.66, rel=1e-4) assert truck_contract.monthly_value() == approx(2070.27, rel=1e-4) bike_contract = LeaseContract(vehicle=bike, customer=customer, length_in_months=36) assert bike_contract.total_value() == approx(20350, rel=1e-4) assert bike_contract.monthly_value() == approx(565.27, rel=1e-4)
def test_lease_contract_with_employee(fixtures): car_contract = LeaseContract(vehicle=fixtures.car, customer=fixtures.employee, length_in_months=12) assert round(car_contract.total_value(), 2) == 21384 assert round(car_contract.monthly_value(), 2) == 1782 truck_contract = LeaseContract(vehicle=fixtures.truck, customer=fixtures.employee, length_in_months=24) assert round(truck_contract.total_value(), 2) == 44718 assert round(truck_contract.monthly_value(), 2) == 1863.25 bike_contract = LeaseContract(vehicle=fixtures.bike, customer=fixtures.employee, length_in_months=36) assert round(bike_contract.total_value(), 2) == 18315 assert round(bike_contract.monthly_value(), 2) == 508.75
def test_lease_contract_total_value_with_customer(self): car_contract = LeaseContract( vehicle=self.car, customer=self.customer, length_in_months=12) self.assertAlmostEqual(car_contract.total_value(), 23760.0, places=3) self.assertAlmostEqual(car_contract.monthly_value(), 1980.0, places=3) truck_contract = LeaseContract( vehicle=self.truck, customer=self.customer, length_in_months=24) self.assertAlmostEqual( truck_contract.total_value(), 49686.66, places=1) self.assertAlmostEqual( truck_contract.monthly_value(), 2070.27, places=1) bike_contract = LeaseContract( vehicle=self.bike, customer=self.customer, length_in_months=36) self.assertAlmostEqual( bike_contract.total_value(), 20350, places=2) self.assertAlmostEqual( bike_contract.monthly_value(), 565.27, places=1)
def test_lease_contract_total_value_with_employee(self): car_contract = LeaseContract(vehicle=self.car, customer=self.employee, length_in_months=18) self.assertAlmostEqual(car_contract.total_value(), 20736.0, places=3) self.assertAlmostEqual(car_contract.monthly_value(), 1152, places=3) truck_contract = LeaseContract(vehicle=self.truck, customer=self.employee, length_in_months=36) self.assertAlmostEqual(truck_contract.total_value(), 43732, places=3) self.assertAlmostEqual(truck_contract.monthly_value(), 1214.78, places=3) bike_contract = LeaseContract(vehicle=self.bike, customer=self.employee, length_in_months=12) self.assertAlmostEqual(bike_contract.total_value(), 19305.0, places=3) self.assertAlmostEqual(bike_contract.monthly_value(), 1608.75, places=3)
def test_buy_contract_total_value_with_customer(fixtures): car_contract = LeaseContract(vehicle=fixtures.car, customer=fixtures.customer, length_in_months=12) assert almost_equal(car_contract.total_value(), 23760.0, places=3) assert almost_equal(car_contract.monthly_value(), 1980.0, places=3) truck_contract = LeaseContract(vehicle=fixtures.truck, customer=fixtures.customer, length_in_months=24) assert almost_equal(truck_contract.total_value(), 49686.66, places=1) assert almost_equal(truck_contract.monthly_value(), 2070.27, places=1) bike_contract = LeaseContract(vehicle=fixtures.bike, customer=fixtures.customer, length_in_months=36) assert almost_equal(bike_contract.total_value(), 20350, places=2) assert almost_equal(bike_contract.monthly_value(), 565.27, places=1)