Example #1
0
 def test_should_not_collide_other_commands(self):
     cmds = [
         'tanam', 'jual', 'panen', 'lihat', 'kirim',
         'plant', 'sell', 'harvest', 'look', 'broadcast'
     ]
     for a in cmds:
         for b in cmds:
             if a != b:
                 self.assertFalse(match(a, b), '{} should not match {}'.format(a, b))
 def valid(self):
     """Return true if the raw data is a valid command"""
     return any([match(self.cmd.lower(), cmd) for cmd in self.VALID_CMDS])
Example #3
0
 def test_char_typo(self):
     cmd = 'jual'
     usrinput = 'jaul'
     self.assertTrue(match(usrinput, cmd))
Example #4
0
 def test_with_less_char(self):
     cmd = 'tanam'
     usrinput = 'tnam'
     self.assertTrue(match(usrinput, cmd))
Example #5
0
 def test_with_defined_limit(self):
     cmd = 'kirim'
     usrinput = 'kirimmm'
     self.assertTrue(match(usrinput, cmd, limit=5))
Example #6
0
 def test_more_chars(self):
     cmd = 'lihat'
     usrinput = 'liihaatt'
     self.assertFalse(match(usrinput, cmd))
Example #7
0
 def test_more_char(self):
     cmd = 'panen'
     usrinput = 'paanen'
     self.assertTrue(match(usrinput, cmd))