<commit_before>
# MultiAgent 2.0
# (c) 2017-2018, NiL, <EMAIL>

import sys, os, time
import doctest

sys.path.append("../py")

from multiagent import *


def test_agent_basic() :
    '''
    >>> test_agent_basic()
    Agent: <<multiagent.Agent name=0 mods_num=1>>
    '''
    print("Initialization.")
    agent = Agent(name = "0")
    print("Agent: %s" % agent.info())

if __name__ == '__main__' :
    result = doctest.testmod()
    print("-" * 50)
    print("[Agent Test] attempted/failed tests: %d/%d" % (result.attempted, result.failed))<commit_msg>Agent tested.<commit_after>
# MultiAgent 2.0
# (c) 2017-2018, NiL, <EMAIL>

import sys, os, time
import doctest

sys.path.append("../py")

from multiagent import *


def test_agent_basic() :
    '''
    >>> test_agent_basic()
    Initialization.
    Agent: <<multiagent.Agent name=0 mods_num=1>>
    Memory: <<multiagent.Memory content_size=1>>
    Memory Content:
    Key: name - Value: 0
    Module: <<multiagent.ObjectModule memory_size=1>>
    Change values of the properties.
    Active: False
    '''
    print("Initialization.")
    agent = Agent(name = "0")
    print("Agent: %s" % agent.info())
    print("Memory: %s" % agent.mem.info())
    print("Memory Content:")
    for key, value in agent.mem.content.items() :
        print("Key: %s - Value: %s" % (key, value))
    for mod in agent.mods :
        print("Module: %s" % mod.info())
    print("Change values of the properties.")
    agent.active = False
    print("Active: %r" % agent.active)

def test_agent_memo() :
    '''
    >>> test_agent_memo()
    Initialization.
    Agent: <<multiagent.Agent name=0 mods_num=1>>
    Active: True
    Memory Content:
    Key: name - Value: 0
    Change properties by directly apply 'agent.memo = memo', where 'memo' is a map storing the new values.
    Active: True
    Memory Content:
    Key: name - Value: 0
    '''
    print("Initialization.")
    agent = Agent(name = "0")
    print("Agent: %s" % agent.info())
    print("Active: %r" % agent.active)
    print("Memory Content:")
    for key, value in agent.mem.content.items() :
        print("Key: %s - Value: %s" % (key, value))
    print("Change properties by directly apply 'agent.memo = memo', where 'memo' is a map storing the new values.")
    memo = {
        "active" : False,
        "__mem" : {
            "name" : "0",
            "key" : True,
        }
    }
    print("Active: %r" % agent.active)
    print("Memory Content:")
    for key, value in agent.mem.content.items() :
        print("Key: %s - Value: %s" % (key, value))


if __name__ == '__main__' :
    result = doctest.testmod()
    print("-" * 50)
    print("[Agent Test] attempted/failed tests: %d/%d" % (result.attempted, result.failed))
{'fraction_non_alphanumeric': 0.16379626236716746, 'fraction_numerical': 0.014290949065591791, 'mean_word_length': 2.8559322033898304, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6506444', 'n_tokens_mistral': 944, 'n_tokens_neox': 910, 'n_words': 246}