Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 def test_skirmish(self):
     src = "attack with 30"
     parsed = parse(src)
     self.assertIsInstance(parsed, SkirmishCommand)
     self.assertEqual(parsed.action, "attack")
     self.assertEqual(parsed.amount, 30)
     self.assertEqual(parsed.troop_type, "infantry")
Exemplo n.º 4
0
 def test_skirmish(self):
     src = "attack with 30"
     parsed = parse(src)
     self.assertIsInstance(parsed, SkirmishCommand)
     self.assertEqual(parsed.action, "attack")
     self.assertEqual(parsed.amount, 30)
     self.assertEqual(parsed.troop_type, "infantry")
Exemplo n.º 5
0
 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")
Exemplo n.º 6
0
    def test_move_implied_all(self):
        src = "lead to hurfendurf"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        self.assertEqual(parsed.where[0].destination, "hurfendurf")
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
 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")
Exemplo n.º 9
0
 def testUnicodeword(self):
     """See what I did there?"""
     src = u'codeword "ಠ_ಠ" is cavalry'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, u'ಠ_ಠ')
     self.assertEqual(parsed.word, "cavalry")
Exemplo n.º 10
0
    def testMoveSubreddit(self):
        src = 'lead 10 to /r/hurfendurf'
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(10, parsed.amount)
        self.assertEqual(parsed.where[0].destination, "hurfendurf")
Exemplo n.º 11
0
 def testRemoveCodeword(self):
     src = 'codeword remove "werg"'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'werg')
     self.assert_(parsed.remove)
     self.assertFalse(parsed.all)
Exemplo n.º 12
0
 def testRemoveCodeword(self):
     src = 'codeword remove "werg"'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'werg')
     self.assert_(parsed.remove)
     self.assertFalse(parsed.all)
Exemplo n.º 13
0
    def testMovePlain(self):
        src = "lead 10 to hurfendurf"

        parsed = parse(src)
        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(10, parsed.amount)
        self.assertEqual(parsed.where[0].destination, "hurfendurf")
Exemplo n.º 14
0
    def testMoveSubreddit(self):
        src = 'lead 10 to /r/hurfendurf'
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(10, parsed.amount)
        self.assertEqual(parsed.where[0].destination, "hurfendurf")
Exemplo n.º 15
0
 def testUnicodeword(self):
     """See what I did there?"""
     src = u'codeword "ಠ_ಠ" is cavalry'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, u'ಠ_ಠ')
     self.assertEqual(parsed.word, "cavalry")
Exemplo n.º 16
0
    def test_move_implied_all(self):
        src = "lead to hurfendurf"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        self.assertEqual(parsed.where[0].destination, "hurfendurf")
Exemplo n.º 17
0
    def testMovePlain(self):
        src = "lead 10 to hurfendurf"

        parsed = parse(src)
        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(10, parsed.amount)
        self.assertEqual(parsed.where[0].destination, "hurfendurf")
Exemplo n.º 18
0
 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")
Exemplo n.º 19
0
 def testBasicCodeword(self):
     src = 'codeword "barf" is infantry'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertFalse(parsed.remove)
     self.assertFalse(parsed.status)
     self.assertEqual(parsed.code, 'barf')
     self.assertEqual(parsed.word, "infantry")
Exemplo n.º 20
0
    def test_targeted(self):
        src = "support #7 with 30"
        parsed = parse(src)

        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "support")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.target, 7)
Exemplo n.º 21
0
    def test_multimove(self):
        src = "lead all to wergland, /r/testplace, somewhereelse"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        self.assertEqual(parsed.names,
                         ["wergland", 'testplace', 'somewhereelse'])
Exemplo n.º 22
0
    def test_multimove(self):
        src = "lead all to wergland, /r/testplace, somewhereelse"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        self.assertEqual(parsed.names,
                         ["wergland", 'testplace', 'somewhereelse'])
Exemplo n.º 23
0
    def test_targeted(self):
        src = "support #7 with 30"
        parsed = parse(src)

        self.assertIsInstance(parsed, SkirmishCommand)
        self.assertEqual(parsed.action, "support")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.target, 7)
Exemplo n.º 24
0
 def testBasicCodeword(self):
     src = 'codeword "barf" is infantry'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertFalse(parsed.remove)
     self.assertFalse(parsed.status)
     self.assertEqual(parsed.code, 'barf')
     self.assertEqual(parsed.word, "infantry")
Exemplo n.º 25
0
    def test_sector_only_move(self):
        src = "lead all to #5"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        dest = parsed.where[0]
        self.assertIsNone(dest.destination)
        self.assertEqual(dest.destination_sector, 5)
Exemplo n.º 26
0
    def test_sector_move(self):
        src = "lead all to wergland#1"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        dest = parsed.where[0]
        self.assertEqual(dest.destination, "wergland")
        self.assertEqual(dest.destination_sector, 1)
Exemplo n.º 27
0
    def test_sector_move(self):
        src = "lead all to wergland#1"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        dest = parsed.where[0]
        self.assertEqual(dest.destination, "wergland")
        self.assertEqual(dest.destination_sector, 1)
Exemplo n.º 28
0
    def test_sector_only_move(self):
        src = "lead all to #5"
        parsed = parse(src)

        self.assertIsInstance(parsed, MoveCommand)
        self.assertEqual(-1, parsed.amount)
        dest = parsed.where[0]
        self.assertIsNone(dest.destination)
        self.assertEqual(dest.destination_sector, 5)
Exemplo n.º 29
0
    def test_misspellings(self):
        """Common mis-spellings are aliased"""
        src = "attack with 30 range"
        parsed = parse(src)

        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "ranged")

        src = "attack with 30 calvary"
        parsed = parse(src)

        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "cavalry")

        src = "attack with 30 calvalry"
        parsed = parse(src)

        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "cavalry")
Exemplo n.º 30
0
    def test_misspellings(self):
        """Common mis-spellings are aliased"""
        src = "attack with 30 range"
        parsed = parse(src)

        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "ranged")

        src = "attack with 30 calvary"
        parsed = parse(src)

        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "cavalry")

        src = "attack with 30 calvalry"
        parsed = parse(src)

        self.assertEqual(parsed.action, "attack")
        self.assertEqual(parsed.amount, 30)
        self.assertEqual(parsed.troop_type, "cavalry")
Exemplo n.º 31
0
 def testCodewordStatus(self):
     src = 'codeword status'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assert_(parsed.status)
Exemplo n.º 32
0
 def testRemoveAllCodeword(self):
     src = 'codeword remove all'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assert_(parsed.remove)
     self.assert_(parsed.all)
Exemplo n.º 33
0
 def testRemoveAllCodeword(self):
     src = 'codeword remove all'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assert_(parsed.remove)
     self.assert_(parsed.all)
Exemplo n.º 34
0
    def test_basic_defect(self):
        text = "defect"
        parsed = parse(text)

        self.assertIsInstance(parsed, DefectCommand)
        self.assertEqual(None, parsed.team)
Exemplo n.º 35
0
 def testMixedCaseDemote(self):
     src = "demote HurfenDurf"
     parsed = parse(src)
     self.assertIsInstance(parsed, PromoteCommand)
     self.assertEqual(parsed.who, "HurfenDurf")
     self.assertEqual(parsed.direction, 0)
Exemplo n.º 36
0
    def test_basic_defect(self):
        text = "defect"
        parsed = parse(text)

        self.assertIsInstance(parsed, DefectCommand)
        self.assertEqual(None, parsed.team)
Exemplo n.º 37
0
 def testDemoteCommand(self):
     src = "demote hurfendurf"
     parsed = parse(src)
     self.assertIsInstance(parsed, PromoteCommand)
     self.assertEqual(parsed.who, "hurfendurf")
     self.assertEqual(parsed.direction, 0)
Exemplo n.º 38
0
    def test_specific_defect(self):
        text = "defect to periwinkle"
        parsed = parse(text)

        self.assertIsInstance(parsed, DefectCommand)
        self.assertEqual(parsed.team, 1)
Exemplo n.º 39
0
 def test_stop(self):
     src = "stop"
     parsed = parse(src)
     self.assertIsInstance(parsed, StopCommand)
Exemplo n.º 40
0
 def testStatusCommand(self):
     src = 'status'
     parsed = parse(src)
     self.assertIsInstance(parsed, StatusCommand)
Exemplo n.º 41
0
 def testDemoteCommand(self):
     src = "demote hurfendurf"
     parsed = parse(src)
     self.assertIsInstance(parsed, PromoteCommand)
     self.assertEqual(parsed.who, "hurfendurf")
     self.assertEqual(parsed.direction, 0)
Exemplo n.º 42
0
 def testStatusCommand(self):
     src = 'status'
     parsed = parse(src)
     self.assertIsInstance(parsed, StatusCommand)
Exemplo n.º 43
0
 def test_region_codeword(self):
     src = 'codeword "Best Londo" is "Orange Londo"'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'Best Londo')
     self.assertEqual(parsed.word, "Orange Londo")
Exemplo n.º 44
0
 def test_extract(self):
     src = "extract"
     parsed = parse(src)
     self.assertIsInstance(parsed, ExtractCommand)
Exemplo n.º 45
0
 def testMixedCaseDemote(self):
     src = "demote HurfenDurf"
     parsed = parse(src)
     self.assertIsInstance(parsed, PromoteCommand)
     self.assertEqual(parsed.who, "HurfenDurf")
     self.assertEqual(parsed.direction, 0)
Exemplo n.º 46
0
 def test_stop(self):
     src = "stop"
     parsed = parse(src)
     self.assertIsInstance(parsed, StopCommand)
Exemplo n.º 47
0
 def testCodewordAliases(self):
     src = 'codeword "werg" is calvalry'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'werg')
     self.assertEqual(parsed.word, "cavalry")
Exemplo n.º 48
0
    def test_invade_command(self):
        src = "invade hurfendurf"
        parsed = parse(src)

        self.assertIsInstance(parsed, InvadeCommand)
        self.assertEqual(parsed.where, "hurfendurf")
Exemplo n.º 49
0
 def testBiggerCodeword(self):
     src = 'codeword "hello, world!" is ranged'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'hello, world!')
     self.assertEqual(parsed.word, "ranged")
Exemplo n.º 50
0
 def testBiggerCodeword(self):
     src = 'codeword "hello, world!" is ranged'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'hello, world!')
     self.assertEqual(parsed.word, "ranged")
Exemplo n.º 51
0
 def testCodewordStatus(self):
     src = 'codeword status'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assert_(parsed.status)
Exemplo n.º 52
0
 def testCodewordAliases(self):
     src = 'codeword "werg" is calvalry'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'werg')
     self.assertEqual(parsed.word, "cavalry")
Exemplo n.º 53
0
 def test_extract(self):
     src = "extract"
     parsed = parse(src)
     self.assertIsInstance(parsed, ExtractCommand)
Exemplo n.º 54
0
 def test_region_codeword(self):
     src = 'codeword "Best Londo" is "Orange Londo"'
     parsed = parse(src)
     self.assertIsInstance(parsed, CodewordCommand)
     self.assertEqual(parsed.code, 'Best Londo')
     self.assertEqual(parsed.word, "Orange Londo")
Exemplo n.º 55
0
    def test_invade_command(self):
        src = "invade hurfendurf"
        parsed = parse(src)

        self.assertIsInstance(parsed, InvadeCommand)
        self.assertEqual(parsed.where, "hurfendurf")
Exemplo n.º 56
0
    def test_specific_defect(self):
        text = "defect to periwinkle"
        parsed = parse(text)

        self.assertIsInstance(parsed, DefectCommand)
        self.assertEqual(parsed.team, 1)