mobilecoinofficial / forest

Enables a Forest of MobileCoin enabled SignalBots. Beta software, APIs may change!
MIT License
19 stars 12 forks source link

Faeries/test questions #181

Closed transfaeries closed 2 years ago

transfaeries commented 2 years ago

Here's the test stuff I've been working on. I moved MockBot to it's own file at forest/mockbot.py, use it to run six tests between test_unit.py and test_questions_bot.py. There is now a clear path to turn all the functions in test_questions_bot.py into real tests.

However, as far as I know, I can't run test_questions_bot.py as a normal bot anymore. Which I would like. So help in making that happen would be nice.

transfaeries commented 2 years ago

@technillogue @iamalwaysuncomfortable I want your opinion on the data structures for the dialogs.

right now it's a Tree of list, each list has one human message and one bot reply (which, doesn't account for bots that send multiple replies so already we need something a bit more sophisticated)

tree = Tree(
        ["test_ask_yesno_question", "Do you like faeries?"],
        [Tree(["yes", "That's cool, me too!"]), Tree(["no", "Aww :c"])],
    )

Any thoughts on a better way of doing it?

transfaeries commented 2 years ago

Also, I get 5 warnings when I run tests. Is that something we just have to live with? or is there a way to address them

transfaeries commented 2 years ago

how do I specify that children should be a list of trees? list [Tree] doesn't work

class Tree:
    """tree implementation for test dialog trees"""

    def __init__(self, dialog: list[str], children: list = None) -> None:
technillogue commented 2 years ago

how do I specify that children should be a list of trees? list [Tree] doesn't work

class Tree:
    """tree implementation for test dialog trees"""

    def __init__(self, dialog: list[str], children: list = None) -> None:

what's the error?

transfaeries commented 2 years ago

with

 def __init__(self, dialog: list[str], children: list[Tree] = None) -> None:

I get:

forest/mockbot.py:57:57: E0601: Using variable 'Tree' before assignment (used-before-assignment)
technillogue commented 2 years ago

use def __init__(self, dialog: list[str], children: list["Tree"] = None) -> None: