示例#1
0
 def test_has_at_after_command(self):
     '''Tests expressions with '@' e.g 'create @xyz' '''
     tokens = 'create @xyz'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': '',
         'group': 'xyz',
         'extras': '',
         'command': 'create'
     })
示例#2
0
 def test_starts_with_groupname(self):
     '''Tests expressions starting with group name '@' e.g 'xyz leave' '''
     tokens = 'xyz leave'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': '',
         'group': 'xyz',
         'extras': '',
         'command': 'leave'
     })
示例#3
0
 def test_has_group_keyword(self):
     '''Tests existence of 'group' in command 'e.g 'join group xyz' '''
     tokens = 'join group xyz'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': '',
         'group': 'xyz',
         'extras': '',
         'command': 'join'
     })
示例#4
0
 def test_starts_with_at(self):
     '''Tests expressions starting with '@' e.g '@xyz create' '''
     tokens = '@xyz create'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': '',
         'group': 'xyz',
         'extras': '',
         'command': 'create'
     })
示例#5
0
 def test_join_with_username(self):
     '''Tests joining with username provided'''
     tokens = 'join xyz as member1'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': 'member1',
         'group': 'xyz',
         'extras': '',
         'command': 'join'
     })
示例#6
0
 def test_has_to_keyword(self):
     '''Tests expressions that have from keyword e.g. invite member1 to xyz'''
     tokens = 'invite member1 to xyz'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': 'member1',
         'group': 'xyz',
         'extras': '',
         'command': 'invite'
     })
示例#7
0
 def test_has_user(self):
     '''Tests expressions that specify user '@' e.g 'delete user_a@xyz' '''
     tokens = 'delete user_a@xyz'.split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {
         'member': 'user_a',
         'group': 'xyz',
         'extras': '',
         'command': 'delete'
     })
示例#8
0
文件: tests.py 项目: tangaza/Tangaza
 def test_has_group_keyword(self):
     """Tests existence of 'group' in command 'e.g 'invite group xyz member_a' """
     tokens = "invite group xyz member_a".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "member_a", "group": "xyz", "extras": "", "command": "invite"})
示例#9
0
文件: tests.py 项目: tangaza/Tangaza
 def test_starts_with_at(self):
     """Tests expressions starting with '@' e.g '@xyz remove member_a' """
     tokens = "@xyz remove member_a".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "member_a", "group": "xyz", "extras": "", "command": "remove"})
示例#10
0
文件: tests.py 项目: tangaza/Tangaza
 def test_has_user(self):
     """Tests expressions that specify user '@' e.g 'delete user_a@xyz' """
     tokens = "delete user_a@xyz".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "user_a", "group": "xyz", "extras": "", "command": "delete"})
示例#11
0
文件: tests.py 项目: tangaza/Tangaza
 def test_starts_with_groupname(self):
     """Tests expressions starting with group name '@' e.g 'xyz leave' """
     tokens = "xyz leave".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "", "group": "xyz", "extras": "", "command": "leave"})
示例#12
0
文件: tests.py 项目: tangaza/Tangaza
 def test_has_at_after_command(self):
     """Tests expressions with '@' e.g 'create @xyz' """
     tokens = "create @xyz".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "", "group": "xyz", "extras": "", "command": "create"})
示例#13
0
文件: tests.py 项目: tangaza/Tangaza
 def test_join_with_username(self):
     """Tests joining with username provided"""
     tokens = "join xyz as member1".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "member1", "group": "xyz", "extras": "", "command": "join"})
示例#14
0
文件: tests.py 项目: tangaza/Tangaza
 def test_has_to_keyword(self):
     """Tests expressions that have from keyword e.g. invite member1 to xyz"""
     tokens = "invite member1 to xyz".split()
     result = grammar.parse(tokens, self.lang)
     self.assertEqual(result, {"member": "member1", "group": "xyz", "extras": "", "command": "invite"})