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

    a = AgentDef("a1", hosting_costs={"foo": 5, "bar": 7})

    assert a.name == "a1"
    assert a.hosting_cost("foo") == 5
    assert a.hosting_cost("bar") == 7
    assert a.hosting_cost("pouet") == 0
コード例 #2
0
    def test_with_hosting_cost(self):

        a = AgentDef('a1', hosting_costs={'foo': 5, 'bar': 7})

        self.assertEqual(a.name, 'a1')
        self.assertEqual(a.hosting_cost('foo'), 5)
        self.assertEqual(a.hosting_cost('bar'), 7)
        self.assertEqual(a.hosting_cost('pouet'), 0)
コード例 #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_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
コード例 #5
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
コード例 #6
0
    def test_with_default_hosting_cost(self):

        a = AgentDef('a1', default_hosting_cost=15)

        self.assertEqual(a.name, 'a1')
        self.assertEqual(a.hosting_cost('foo'), 15)
コード例 #7
0
def test_with_default_hosting_cost():

    a = AgentDef("a1", default_hosting_cost=15)

    assert a.name == "a1"
    assert a.hosting_cost("foo") == 15