aea.test_
tools.test_
skill
This module contains test case classes based on pytest for AEA skill testing.
BaseSkillTestCase Objects
A class to test a skill.
skill
Get the skill.
get_
quantity_
in_
outbox
Get the quantity of envelopes in the outbox.
get_
message_
from_
outbox
Get message from outbox.
drop_
messages_
from_
outbox
Dismiss the first 'number' number of message from outbox.
get_
quantity_
in_
decision_
maker_
inbox
Get the quantity of messages in the decision maker inbox.
get_
message_
from_
decision_
maker_
inbox
Get message from decision maker inbox.
drop_
messages_
from_
decision_
maker_
inbox
Dismiss the first 'number' number of message from decision maker inbox.
assert_
quantity_
in_
outbox
Assert the quantity of messages in the outbox.
assert_
quantity_
in_
decision_
making_
queue
Assert the quantity of messages in the decision maker queue.
message_
has_
attributes
| @staticmethod
| message_has_attributes(actual_message: Message, message_type: Type[Message], **kwargs: Any, ,) -> Tuple[bool, str]
Evaluates whether a message's attributes match the expected attributes provided.
Arguments:
actual_message
: the actual messagemessage_type
: the expected message typekwargs
: other expected message attributes
Returns:
boolean result of the evaluation and accompanied message
build_
incoming_
message
| build_incoming_message(message_type: Type[Message], performative: Message.Performative, dialogue_reference: Optional[Tuple[str, str]] = None, message_id: Optional[int] = None, target: Optional[int] = None, to: Optional[Address] = None, sender: Optional[Address] = None, is_agent_to_agent_messages: Optional[bool] = None, **kwargs: Any, ,) -> Message
Quickly create an incoming message with the provided attributes.
For any attribute not provided, the corresponding default value in message is used.
Arguments:
message_type
: the type of the messagedialogue_reference
: the dialogue_referencemessage_id
: the message_idtarget
: the targetperformative
: the performativeto
: the 'to' addresssender
: the 'sender' addressis_agent_to_agent_messages
: whether the dialogue is between agents or componentskwargs
: other attributes
Returns:
the created incoming message
build_
incoming_
message_
for_
skill_
dialogue
| build_incoming_message_for_skill_dialogue(dialogue: Dialogue, performative: Message.Performative, message_type: Optional[Type[Message]] = None, dialogue_reference: Optional[Tuple[str, str]] = None, message_id: Optional[int] = None, target: Optional[int] = None, to: Optional[Address] = None, sender: Optional[Address] = None, **kwargs: Any, ,) -> Message
Quickly create an incoming message with the provided attributes for a dialogue.
For any attribute not provided, a value based on the dialogue is used. These values are shown in parentheses in the list of parameters below.
NOTE: This method must be used with care. The dialogue provided is part of the skill which is being tested. Because for any unspecified attribute, a "correct" value is used, the test will be, by design, insured to pass on these values.
Arguments:
dialogue
: the dialogue to which the incoming message is intendedperformative
: the performative of the messagemessage_type
: (the message_class of the provided dialogue) the type of the messagedialogue_reference
: (the dialogue_reference of the provided dialogue) the dialogue reference of the messagemessage_id
: (the id of the last message in the provided dialogue + 1) the id of the messagetarget
: (the id of the last message in the provided dialogue) the target of the messageto
: (the agent address associated with this skill) the receiver of the messagesender
: (the counterparty in the provided dialogue) the sender of the messagekwargs
: other attributes
Returns:
the created incoming message
prepare_
skill_
dialogue
| prepare_skill_dialogue(dialogues: Dialogues, messages: Tuple[DialogueMessage, ...], counterparty: Optional[Address] = None, is_agent_to_agent_messages: Optional[bool] = None) -> Dialogue
Quickly create a dialogue.
The 'messages' argument is a tuple of DialogueMessages. For every DialogueMessage (performative, contents, is_incoming, target): - if 'is_incoming' is not provided: for the first message it is assumed False (outgoing), for any other message, it is the opposite of the one preceding it. - if 'target' is not provided: for the first message it is assumed 0, for any other message, it is the index of the message before it in the tuple of messages + 1.
Arguments:
dialogues
: a dialogues classcounterparty
: the message_idmessages
: the dialogue_referenceis_agent_to_agent_messages
: whether the dialogue is between agents or components
Returns:
the created incoming message
setup
Set up the skill test case.