sukeesh / Jarvis

Personal Assistant for Linux and macOS
MIT License
3.02k stars 1.04k forks source link

"Doctest"-style tests #393

Open pnhofmann opened 5 years ago

pnhofmann commented 5 years ago

How about implementing something like python doctest:

Basically, if there is a command like movie director:

~> What can i do for you?
movie director lord of the rings
Peter Jackson

Copy paste above output into the doc-string - so it looks like:

@plugin(network=True)
def movie_director(jarvis, movie):
    """
    prints director of movie

    ~> What can i do for you?
    movie director lord of the rings
    Peter Jackson
    """

    data = main(jarvis, movie)
    if data is not None:
        for d in data['director']:
            jarvis.say(d['name'])

And have some test-routine to parse the docstring and check if "movie director lord of the rings" really returns "Peter Jackson".

Advantages:

tuhinmallick commented 1 year ago

Is this issue still open, if yes i would like to work on it

Akul2010 commented 1 year ago

I think it's been lost to time.

pnhofmann commented 1 year ago

Sorry, I thought I answered this.

@tuhinmallick This was basically an idea I had 4 years ago. Never implemented it and I don't even know if it's a good idea.

But if you want to give it a try - sure!

Just don't consider it as something that "has" to be implemented or even "has" to look like how I described it here.