コード例 #1
0
def test_with_routes():

    a = AgentDef("a1", routes={"psycho": 5, "killer": 7})

    assert a.name == "a1"
    assert a.route("psycho") == 5
    assert a.route("killer") == 7
    assert a.route("ahahah") == 1
コード例 #2
0
    def test_with_routes(self):

        a = AgentDef('a1', routes={'psycho': 5, 'killer': 7})

        self.assertEqual(a.name, 'a1')
        self.assertEqual(a.route('psycho'), 5)
        self.assertEqual(a.route('killer'), 7)
        self.assertEqual(a.route('ahahah'), 1)
コード例 #3
0
def test_api_create_agent_with_specific_cost_as_dict():

    a1 = AgentDef('a1', routes={'a2': 8},
                  hosting_costs={'c1': 3})

    assert a1.name == 'a1'
    # Specific and defaults values for route and hosting costs:
    assert a1.route('a_foo') == 1
    assert a1.route('a2') == 8
    assert a1.hosting_cost('c1') == 3
    assert a1.hosting_cost('computation_bar') == 0
コード例 #4
0
    def test_with_default_route(self):

        a = AgentDef('a1', default_route=12)

        self.assertEqual(a.name, 'a1')
        self.assertEqual(a.route('foo'), 12)
        self.assertEqual(a.route('bar'), 12)
コード例 #5
0
def test_with_default_route():

    a = AgentDef("a1", default_route=12)

    assert a.name == "a1"
    assert a.route("foo") == 12
    assert a.route("bar") == 12
コード例 #6
0
def test_api_create_agent_with_default_cost():

    a1 = AgentDef('a1', default_route=10, default_hosting_cost=5)

    assert a1.name == 'a1'
    # Defaults values for route and hosting costs:
    assert a1.route('a_foo') == 10
    assert a1.hosting_cost('computation_bar') == 5
コード例 #7
0
def test_api_create_agent_minimal():

    # The name is the only mandatory param when creating an agent definition?
    a1 = AgentDef('a1')

    assert a1.name == 'a1'
    # Defaults values for route and hosting costs:
    assert a1.route('a_foo') == 1
    assert a1.hosting_cost('computation_bar') == 0