Пример #1
0
def test_report_one():
    log1 = tasks.Log()
    worker1 = tasks.Worker("Dima")
    worker2 = tasks.Worker("John")
    task1 = tasks.HourlyPaymentTask("Homework", 10, 3)
    task2 = tasks.Task("Take cup of tea", 5)
    worker1.take_task(task1, log1)
    worker2.take_task(task2, log1)
    assert log1.report() == 'Dima\t$30\nJohn\t$5'
Пример #2
0
def test_report():
    # Data initialization
    w1 = tasks.Worker("Bill", 5, True)
    w2 = tasks.Worker("John", 3, True)
    t1 = tasks.HourlyTask(w1, 4, True, 4)
    t2 = tasks.FixedTask(w2, 30, True)
    p1 = tasks.HourlyPaymentPerTask(w1, t1)
    p2 = tasks.FixedPaymentPerTask(w2, t2)
    l = tasks.Log(p1, p2)
    assert l.report() == """Bill\t$20
Пример #3
0
def test_report():
    worker1 = tasks.Worker("Bill")
    worker2 = tasks.Worker("John")
    log = tasks.Log()
    task_fixed = tasks.FixedPayment("build home", 20)
    task_per_h = tasks.PaymentPerHour("do nothing", 15, 2)
    worker1.take_task(task_fixed)
    worker2.take_task(task_per_h)
    worker2.confirm(task_per_h, log)
    worker1.confirm(task_fixed, log)
    assert log.report() == """Bill\t$20
Пример #4
0
def test_report_one():
    log = tasks.Log()
    worker_artem = tasks.Worker("Artem")
    worker_alex = tasks.Worker("Alex")
    worker_masha = tasks.Worker("Masha")
    masha_fixet_task = tasks.Task("Task1", 300)
    fixet_task = tasks.Task("Task2", 100)
    hoyrly_task = tasks.HourlyTask("Task3", 200, 3)
    worker_masha.get_task(masha_fixet_task, log)
    worker_artem.get_task(fixet_task, log)
    worker_alex.get_task(hoyrly_task, log)
    assert log.report() == 'Masha\t$300\nArtem\t$100\nAlex\t$600'
Пример #5
0
def test_report_four():
    log1 = tasks.Log()
    worker1 = tasks.Worker("Dima")
    worker2 = tasks.Worker("John")
    worker3 = tasks.Worker("Bill")
    task1 = tasks.HourlyPaymentTask("Homework", 10, 3)
    task2 = tasks.Task("Take cup of tea", 5)
    task3 = tasks.Task("Web serfing", 25)
    worker1.take_task(task1, log1)
    worker2.take_task(task2, log1)
    worker3.take_task(task3, log1)
    assert log1.report() == 'Dima\t$30\nJohn\t$5\nBill\t$25'
Пример #6
0
def test_tasks_reporting():
    logg = tasks.Log()
    t1 = tasks.Task("one", 20)
    t2 = tasks.Task("two", 70)
    d = tasks.DailyPlan()
    d.create_plan(t1, t2)
    w1 = tasks.Worker("John")
    w2 = tasks.Worker("Mary")
    w2.get_task_from_dp(d)
    w2.log_task(logg, w2.get_current_task())
    w1.get_task_from_dp(d)
    w1.log_task(logg, w1.get_current_task(), 5)
    assert (logg.get_report()) == """Mary earned $70
Пример #7
0
def test_report():
    w1 = tasks.Worker(1, "bill")
    w2 = tasks.Worker(2, "tom")

    t1 = tasks.FTask(1, "task1", 34)
    t2 = tasks.FTask(2, "task2", 10)
    t3 = tasks.HTask(3, "task3", 5, 10)

    l = tasks.Log()

    w1.approve(l, t2)
    w2.approve(l, t1)
    w2.approve(l, t3)
    assert l.report() == "task3,tom: 50\n" \
                         "task1,tom: 34\n" \
                         "task2,bill: 10"
Пример #8
0
def test_tasks_assignment_from_daily_plan():
    t1 = tasks.Task("one", 20)
    t2 = tasks.Task("two", 25)
    d = tasks.DailyPlan()
    d.create_plan(t1, t2)
    w1 = tasks.Worker("John")
    w1.get_task_from_dp(d)
    assert (w1.get_current_task()) == ('two', 25)
    assert (d.get_plan()) == [('one', 20)]
Пример #9
0
def test_worker_creation():
    w1 = tasks.Worker("John")
    assert (w1.get_name()) == "John"