Exemplo n.º 1
0
 def _start_transition(self, key):
     if regexs.regex_and(key):
         self.state = states.STATE_AND
     elif regexs.regex_or(key):
         self.state = states.STATE_OR
     elif utilities.includes(self.allowed_props, key):
         self.state = states.STATE_PROP
     else:
         raise exceptions.ERROR_INVALID_KEY_FOR_START_STATE
Exemplo n.º 2
0
 def test_includes(self):
     self.assertTrue(utilities.includes([1, 2, 3], 1))
     self.assertTrue(utilities.includes(['a', 'b', 'c'], 'a'))
     self.assertFalse(utilities.includes([1, 2, 3], 4))
     self.assertFalse(utilities.includes(['a', 'b', 'c'], 'd'))
Exemplo n.º 3
0
 def _prop_transition(self, key):
     if utilities.includes(self.operators, key):
         self.state = states.STATE_OPERATOR
     else:
         raise exceptions.ERROR_INVALID_KEY_FOR_PROP_STATE
Exemplo n.º 4
0
 def _or_transition(self, key):
     if utilities.includes(self.allowed_props, key):
         self.state = states.STATE_PROP
     else:
         raise exceptions.ERROR_INVALID_KEY_FOR_OR_STATE