Ejemplo n.º 1
0
    def test_defaults(self):
        cli = Cli()
        opt, vls = cli.parse()

        self.assertEquals(opt.message, '')
        self.assertEquals(opt.soundfile, None)
        self.assertEquals(opt.exitat, 5)
        self.assertEquals(opt.timeline, False)
        self.assertEquals(opt.fullscreen, False)
        self.assertEquals(opt.alarm, False)
Ejemplo n.º 2
0
    def test_defaults(self):
        cli = Cli()
        opt, vls = cli.parse()

        self.assertEquals(opt.message, '')
        self.assertEquals(opt.soundfile, None)
        self.assertEquals(opt.exitat, 5)
        self.assertEquals(opt.timeline, False)
        self.assertEquals(opt.fullscreen, False)
        self.assertEquals(opt.alarm, False)
Ejemplo n.º 3
0
    def test_if_have_just_those_options(self):
        cli = Cli()
        opt, vls = cli.parse()

        #FIXME: need to find another way to test if 'Cli' just have that options
        self.assertEquals(opt, {'fullscreen': False,
                                'message': '',
                                'exitat': 5,
                                'soundfile': None,
                                'timeline': False,
                                'debug': False,
                                'alarm': False,
                                'color': ''})
Ejemplo n.º 4
0
    def test_if_have_just_those_options(self):
        cli = Cli()
        opt, vls = cli.parse()

        #FIXME: need to find another way to test if 'Cli' just have that options
        self.assertEquals(
            opt, {
                'fullscreen': False,
                'message': '',
                'exitat': 5,
                'soundfile': None,
                'timeline': False,
                'debug': False,
                'alarm': False,
                'color': ''
            })
Ejemplo n.º 5
0
    def test_e2e(self):
        cli = Cli(Feed())
        cmds = [
            "Josh -> As Josh used to say",
            "Josh",
            "Josh follows Bob",
            "Bob -> @Josh whats'up?",
            "John -> pancakes",
            "Bob -> @John you cooking pancakes?",
            "Josh -> mamma mia",
            "Josh wall",
        ]
        parsed = [cli.parse(cmd) for cmd in cmds]
        run = [cli.run(cmd) for cmd in parsed]
        expected = [
            "mamma mia",
            "@John you cooking pancakes?",
            "@Josh whats'up?",
            "As Josh used to say",
        ]

        self.assertEqual(expected, run[-1])
Ejemplo n.º 6
0
from feed import Feed
from cli import Cli

if __name__ == "__main__":
    cli = Cli(Feed())
    while True:
        cmd_str = input(">> ")
        cmd = cli.parse(cmd_str)
        res = cli.run(cmd)
        if res:
            print(res)
Ejemplo n.º 7
0
from dqn_agent_bananas import Agent
from collections import deque
from cli import Cli
import numpy as np
import torch
import matplotlib.pyplot as plt
from unityagents import UnityEnvironment
import pandas as pd
import os

THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))

cli = Cli()
args = cli.parse()

env = UnityEnvironment(file_name="./UnityEnv/Banana.exe")

brain_name = env.brain_names[0]
brain = env.brains[brain_name]


def train(episodes=1000, eps_start=1.0, eps_end=0.01, eps_decay=0.995):
    agent = Agent(state_size=37, action_size=4, seed=0)
    scores = []
    scores_window = deque(maxlen=100)
    eps = eps_start

    for i_episode in range(1, episodes + 1):
        env_info = env.reset(train_mode=True)[brain_name]
        state = env_info.vector_observations[0]
        score = 0
Ejemplo n.º 8
0
 def test_parse_write(self):
     cli = Cli(None)
     res = cli.parse("Josh -> Hello!")
     parsed_cmd = self.josh_hello_cmd
     self.assertEqual(parsed_cmd, res)