# Path: chromabot/utils.py
# def base36decode(number):
# def extract_command(text):
# def forcelist(item):
# def name_to_id(name):
# def now():
# def num_to_team(number, config=None):
# def pairwise(iterable):
# def team_to_num(team):
# def timestr(secs=None):
# def version(config):
# 
# Path: chromabot/parser.py
# def parse(s):
#     result = root.parseString(s)
#     return result[0]


import unittest
from chromabot import utils
from chromabot.commands import *
from chromabot.parser import parse

    def test_attack_with_bad_type(self):
        src = "attack with 30 muppet"
        parsed = parse(src)
        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "muppet")

    def test_attack_with_codeword(self):
        src = "attack with 30 copies of my college thesis"
        parsed = parse(src)
        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "copies of my college thesis")

    def test_support(self):
        src = "support with 30"
        parsed = parse(src)
        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "support")
        self.assertEqual(parsed.amount, 30)

    def test_oppose(self):
        src = "oppose with 30"
        parsed = parse(src)

        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "attack")

# Path: chromabot/utils.py
# def base36decode(number):
# def extract_command(text):
# def forcelist(item):
# def name_to_id(name):
# def now():
# def num_to_team(number, config=None):
# def pairwise(iterable):
# def team_to_num(team):
# def timestr(secs=None):
# def version(config):
# 
# Path: chromabot/parser.py
# def parse(s):
#     result = root.parseString(s)
#     return result[0]


# Path: chromabot/tests/parsetest.py
import unittest
from chromabot import utils
from chromabot.commands import *
from chromabot.parser import parse


    def test_attack_with_bad_type(self):
        src = "attack with 30 muppet"
        parsed = parse(src)
        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "muppet")

    def test_attack_with_codeword(self):
        src = "attack with 30 copies of my college thesis"
        parsed = parse(src)
        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "copies of my college thesis")

    def test_support(self):
        src = "support with 30"
        parsed = parse(src)
        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "support")
        self.assertEqual(parsed.amount, 30)

    def test_oppose(self):
        src = "oppose with 30"
        parsed = parse(src)

        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "attack")

        self.assertEqual(parsed.amount, 30)