def test_send_message():

    message = "This is a test"

    in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)

    print("this is me testing....\n")

    assert in_out.write_message(message=message)
def test_read_message():

    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = "******"

    in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)

    in_out.write_message("Please enter your name.")
    message = in_out.read_message()

    assert message == InputOutput.INPUT_CACHE_DATA_USER
示例#3
0
def test_input_name_and_verify():

    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = "******"

    in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)

    in_out.write_message("Please enter your name.")
    message = in_out.read_message()

    test_analysis = MessageTypeAnalysis(message)
    assert test_analysis.is_name() == "Alex"
def test_smoking():
    """
    > pytest -s

    :return:
    """
    #DEBUG_ENABLED = True
    InputOutput.CACHE_MODE = True
    in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)

    InputOutput.INPUT_CACHE_DATA_USER = "******"

    therapist = Therapist(in_out=in_out)

    assert therapist.interview.ask_for_name()

    print("name: {}".format(therapist.client.get_name()))

    assert therapist.client.get_name() == "Alex"

    InputOutput.INPUT_CACHE_DATA_USER = "******"
    #InputOutput.INPUT_CACHE_DATA_USER = "******"

    message_for_dream = MessageTypeAnalysis(
        InputOutput.INPUT_CACHE_DATA_USER).is_dream(Request.SUBJECT)
    a_dream = Dream(message_for_dream)
    AnalyseDream(a_dream)

    assert a_dream.get_subject() == Subject.SOMEONE
    assert a_dream.get_direct_object() == "Car"
    assert a_dream.get_ratings() == [Rating.NEGATIVE]
def test_sample_dream_two():
    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = [
        "Hi Siggy", "I am Hannah",
        "she had a dream about going on a journey with a friend. As we left, a really bad storm hit.",
        "It was supposed to be fun but took a dark turn", "new dream",
        "I took a trip to the beach with my family. Mum and dad had a big argument",
        "Everything was good until then", "nope", "get analysis"
    ]

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Hannah"

    assert therapist.client.get_dream().get_subject() == Subject.SOMEONE
    assert therapist.client.get_dream().get_topics() == [
        Topic.DEATH, Topic.PSYCHE
    ]
    assert therapist.client.get_dream().get_ratings() == [
        Rating.VERY_NEGATIVE, Rating.NEGATIVE
    ]
    assert therapist.client.get_dream().get_direct_object() == "Storm"

    assert therapist.client.get_dream(1).get_subject() == Subject.CLIENT
    assert therapist.client.get_dream(1).get_topics() == [
        Topic.DEATH, Topic.PSYCHE, Topic.OEDIPUS_COMPLEX
    ]
    assert therapist.client.get_dream(1).get_ratings() == [Rating.POSITIVE]
    assert therapist.client.get_dream(1).get_direct_object() == "Dad"
def test_therapist_get_2_dreams():

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()
def test_therapist_get_dream():

    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = [
        "This is Alex here. How are you?",
        "I rode through the dessert on a horse with no name",
        "It felt good to be out of the rain", "no", "new dream",
        "In the dessert, you can't remember your car",
        "Because there aint no one to give you no shame.", "nothing",
        "get analysis"
    ]

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Alex"

    assert therapist.client.get_dream() is not None

    assert therapist.client.get_dream().get_subject() == Subject.CLIENT

    assert therapist.client.get_dream().get_topics() == [Topic.PARENTS]

    assert therapist.client.get_dream().get_ratings() == [Rating.POSITIVE]

    assert therapist.client.get_dream().get_direct_object() == "Horse"
def test_sample_dream_five():
    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = [
        "Hi. My name is blah", "It's actually Sarah",
        "Someone broke into my house. They were dressed in black. I chased him and he ran into the darkness.",
        "It was scary and spooky", "no", "nope", "new dream",
        "I am sitting in a train and it goes through all these beautiful places, from mountains to fields",
        "very good", "no", "All good Siggy", "get analysis"
    ]

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Sarah"

    assert therapist.client.get_dream().get_subject() == Subject.SOMEONE
    assert therapist.client.get_dream().get_topics() == [
        Topic.BODY, Topic.PSYCHE
    ]
    assert therapist.client.get_dream().get_ratings() == [
        Rating.VERY_NEGATIVE, Rating.NEGATIVE
    ]
    assert therapist.client.get_dream().get_direct_object() == "Chase"

    assert therapist.client.get_dream(1).get_subject() == Subject.CLIENT
    assert therapist.client.get_dream(1).get_topics() == [
        Topic.SEX_SYMBOL, Topic.PSYCHE
    ]
    assert therapist.client.get_dream(1).get_ratings() == [Rating.POSITIVE]
    assert therapist.client.get_dream(1).get_direct_object() == "Field"
def test_sample_dream_four():
    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = [
        "I am Warrick. How are you?",
        "She is standing in front of the drawer of her writing table, with which she is so familiar that she knows immediately if anybody has been through it",
        "It was comforting", "no", "no", "new dream",
        "I was walking through the street and a load of naked people started chasing me.",
        "It was a weird. Ultimately fun, I guess", "That does it"
        "F**k off!", "get analysis"
    ]

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Warrick"

    assert therapist.client.get_dream().get_subject() == Subject.SOMEONE
    assert therapist.client.get_dream().get_topics() == [Topic.OEDIPUS_COMPLEX]
    assert therapist.client.get_dream().get_ratings() == [Rating.POSITIVE]
    assert therapist.client.get_dream().get_direct_object() == "Table"

    assert therapist.client.get_dream(1).get_subject() == Subject.CLIENT
    assert therapist.client.get_dream(1).get_topics() == [
        Topic.BODY, Topic.PSYCHE
    ]
    assert therapist.client.get_dream(1).get_ratings() == [Rating.POSITIVE]
    assert therapist.client.get_dream(1).get_direct_object() == "Chase"
def test_sample_dream_three():
    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = [
        "Hi", "It's Chris here",
        "She is going through the hall of her house and strikes her head against the low-hanging chandelier, so that her head bleeds",
        "It was my friends house", "It was darker than usual",
        "not much else i remember", "no", "new dream",
        "I was walking past a mansion and a naked person was lying in the sun.",
        "I remember the weather being nice. She was rather beautiful",
        "not really", "no!", "get analysis"
    ]

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Chris"

    assert therapist.client.get_dream().get_subject() == Subject.SOMEONE
    assert therapist.client.get_dream().get_topics() == [Topic.BODY]
    assert therapist.client.get_dream().get_ratings() == [Rating.NEGATIVE]
    assert therapist.client.get_dream().get_direct_object() == "House"

    assert therapist.client.get_dream(1).get_subject() == Subject.CLIENT
    assert therapist.client.get_dream(1).get_topics() == [Topic.BODY]
    assert therapist.client.get_dream(1).get_ratings() == [
        Rating.POSITIVE, Rating.POSITIVE
    ]
    assert therapist.client.get_dream(1).get_direct_object() == "Naked"
示例#11
0
def main(argv=None):
    """
	> python -m Fralysis.GUI
	> pytest

	Main method to run terminal interface

	:param argv:
	:return:
	"""
    #class StartTherapySession:

    #def __init__(self):
    if DEBUG_ENABLED:
        print("0 - Program starts")

    in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)
    #in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_KIVY)
    therapist = Therapist(in_out=in_out)

    success = therapist.start_therapy()

    if DEBUG_ENABLED:
        if success:
            print("Therapy was successful")
        else:
            print("Therapy was not successful")

    if DEBUG_ENABLED:
        print("END - Program exits")
示例#12
0
def test_is_dream():

    message = "A king rode by on a white horse"
    for message in VALID_DREAMS:
        in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)

        test_analysis = MessageTypeAnalysis(message)
        print(str(type(test_analysis)))
        assert str(test_analysis.is_dream()) == message
def test_therapist_get_name():
    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = "******"

    in_out = InputOutput(interface_type=InputOutput.DEFAULT_PROMPT)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Alex"
def test_ask_for_name():
    """
    > pytest -s

    :return:
    """

    InputOutput.CACHE_MODE = True
    in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE)

    InputOutput.INPUT_CACHE_DATA_USER = [
        "This is Alex here. How are you?",
    ]

    therapist = Therapist(in_out=in_out)

    assert therapist.interview.ask_for_name()

    print("name: {}".format(therapist.client.get_name()))

    assert therapist.client.get_name() == "Alex"
def test_sample_dream_one():
    InputOutput.CACHE_MODE = True
    InputOutput.INPUT_CACHE_DATA_USER = [
        "Hi", "My name is Sam",
        "I was cycling around Brighton. A red car started chasing me. It hit me. A man got out. It turned out to be my father.",
        "our current relationship is not great",
        "It was dark when this happened", "get analysis"
    ]

    in_out = InputOutput(interface_type=InputOutput.CACHE_MODE)

    therapist = Therapist(in_out=in_out)

    therapist.start_therapy()

    assert therapist.client.get_name() == "Sam"

    assert therapist.client.get_dream().get_subject() == Subject.CLIENT
    assert therapist.client.get_dream().get_topics() == [
        Topic.PSYCHE, Topic.SEX_SYMBOL, Topic.OEDIPUS_COMPLEX
    ]
    assert therapist.client.get_dream().get_ratings() == [Rating.NEGATIVE]
    assert therapist.client.get_dream().get_direct_object() == "Father"