Пример #1
0
def test_invalid_type():
    from adjsim import core, analysis, utility, decision

    action = True

    agent = core.Agent()
    agent.decision = decision.RandomSingleCastDecision()

    with pytest.raises(utility.ActionException):
        agent.actions["trivial"] = action
Пример #2
0
def test_trivial():
    from adjsim import core, analysis, utility, decision

    action = lambda env, source: 0

    agent = core.Agent()
    agent.decision = decision.RandomSingleCastDecision()
    agent.actions["trivial"] = action

    test_sim = core.Simulation()
    test_sim.agents.add(agent)

    common.step_simulate_interpolation(test_sim)
Пример #3
0
def test_invalid_too_many_arguments():
    from adjsim import core, analysis, utility, decision

    action = lambda env, source, kek: 0

    agent = core.Agent()
    agent.decision = decision.RandomSingleCastDecision()
    agent.actions["trivial"] = action

    test_sim = core.Simulation()
    test_sim.agents.add(agent)

    with pytest.raises(utility.DecisionException):
        common.step_simulate_interpolation(test_sim)
Пример #4
0
def test_invalid_decision():
    from adjsim import core, analysis, utility

    action = lambda env, source: 0

    agent = core.Agent()
    agent.decision = None
    agent.actions["trivial"] = action

    test_sim = core.Simulation()
    test_sim.agents.add(agent)

    with pytest.raises(utility.DecisionException):
        common.step_simulate_interpolation(test_sim)