Commit 33d7c6f9 authored by Chanelle Lee's avatar Chanelle Lee
Browse files

Forgot to add the agent tester code

parent f66b42e7
import pytest
from noComparisonSimulation.agent import *
def test_initialise_valid():
idNum = 1
belief = np.array([0.6, 0.2, 0.2])
distrust = 0.001
w = 1
numOptions = 3
agent = Agent(idNum, belief, distrust, w, numOptions)
assert agent.idNum == idNum
assert agent._belief == belief
assert agent._distrust == distrust
assert agent._w == w
assert agent._numOptions == numOptions
assert agent.reached_decision is False
@pytest.mark.parametrize("idNum, belief, distrust, w, numOptions", [
(1.5, np.array([0.6, 0.2, 0.2]), 0.001, 1, 3),
(1, np.array([0.6, 0.2, 0.2]), "distrust", 1, 3),
(1, np.array([0.6, 0.2, 0.2]), 0.001, "w", 3),
(1, np.array([0.6, 0.2, 0.2]), 0.001, 1, 3.5)
])
def test_initialise_invalid_type(idNum, belief, distrust, w, numOptions):
with pytest.raises(TypeError):
Agent(idNum, belief, distrust, w, numOptions)
@pytest.mark.parametrize("distrust, w", [
(0, 1),
(0.5, 1),
(0.001, -3)
])
def test_initialise_invalid_values(distrust, w):
with pytest.raises(ValueError):
Agent(1, np.array([0.6, 0.2, 0.2]), distrust, w, 3)
@pytest.mark.parametrize("belief", [
(np.array([0.4, 0.6])),
(np.array([0.3, 0.2, 0.4])),
(np.array([0.9, -0.3, 0.4]))
])
def test_initialise_invalid_belief(belief):
with pytest.raises(ValueError):
Agent(1, belief, 0.001, 1, 3)
# def test_setBelief_valid():
# agent = Agent(1, 0.6, 0.001, 1, 3)
# agent.setBelief()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment