Exemplo n.º 1
0
 def test_new_month(self):
     """Test that the new_month function works in general, aka test that it
     sets up the bill and rate correctly, and that it bills the right monthly
     fee.
     """
     mc = MTMContract(datetime.date(2000, 9, 29))
     bill = Bill()
     mc.new_month(month=10, year=2000, bill=bill)
     assert mc.bill is bill
     # check that the rate per minute is appropriate for the class
     self.assertEqual(mc.bill.min_rate, MTM_MINS_COST)
     # check that the monthly fee have been billed
     self.assertEqual(mc.bill.fixed_cost, MTM_MONTHLY_FEE)
Exemplo n.º 2
0
def test_task3_MTM() -> None:
    # MTM Contracts
    contract = MTMContract(datetime.date(2017, 2, 15))
    bill = Bill()
    contract.new_month(3, 2017, bill)
    assert bill.get_cost() == pytest.approx(50.0)
    contract.bill_call(gen_call(10))
    assert bill.get_cost() == pytest.approx(50.05)
    contract.bill_call(gen_call(50))
    assert bill.get_cost() == pytest.approx(50.1)
    bill = Bill()
    contract.new_month(4, 2017, bill)
    assert bill.get_cost() == pytest.approx(50.0)
    assert contract.cancel_contract() == pytest.approx(50.0)