예제 #1
0
    def test_shifts(self, mock_shift, mock_parse_tokenize):
        result = _parser._parse_text_rule('test rule')

        self.assertEqual('result', result)
        mock_parse_tokenize.assert_called_once_with('test rule')
        mock_shift.assert_has_calls(
            [mock.call('tok1', 'val1'), mock.call('tok2', 'val2')])
예제 #2
0
    def test_shifts(self, mock_shift, mock_parse_tokenize):
        result = _parser._parse_text_rule('test rule')

        self.assertEqual('result', result)
        mock_parse_tokenize.assert_called_once_with('test rule')
        mock_shift.assert_has_calls(
            [mock.call('tok1', 'val1'), mock.call('tok2', 'val2')])
예제 #3
0
 def test_A_and_B_or_C_with_group_and_not_7(self):
     for expression in [
             '( @ ) and ! or not @', '@ and ( ! ) or not @',
             '@ and ! or not ( @ )', '@ and ! or ( not @ )',
             '( @ and ! ) or not @', '( @ and ! or not @ )'
     ]:
         result = _parser._parse_text_rule(expression)
         self.assertEqual('((@ and !) or not @)', str(result))
예제 #4
0
 def test_A_and_B_or_C_with_group_and_not_7(self):
     for expression in ['( @ ) and ! or not @',
                        '@ and ( ! ) or not @',
                        '@ and ! or not ( @ )',
                        '@ and ! or ( not @ )',
                        '( @ and ! ) or not @',
                        '( @ and ! or not @ )']:
         result = _parser._parse_text_rule(expression)
         self.assertEqual('((@ and !) or not @)', str(result))
예제 #5
0
 def test_A_and_B_or_C_and_D(self):
     result = _parser._parse_text_rule('@ and ! or @ and !')
     self.assertEqual('((@ and !) or (@ and !))', str(result))
예제 #6
0
 def test_A_or_B_and_C_or_D(self):
     result = _parser._parse_text_rule('@ or ! and @ or !')
     self.assertEqual('(@ or (! and @) or !)', str(result))
예제 #7
0
 def test_A_or_B_or_C(self):
     result = _parser._parse_text_rule('@ or ! or @')
     self.assertEqual('(@ or ! or @)', str(result))
예제 #8
0
    def test_fail(self, mock_parse_tokenize):
        result = _parser._parse_text_rule('test rule')

        self.assertIsInstance(result, _checks.FalseCheck)
        mock_parse_tokenize.assert_called_once_with('test rule')
예제 #9
0
 def test_A_and_B_or_C_and_D(self):
     result = _parser._parse_text_rule('@ and ! or @ and !')
     self.assertEqual('((@ and !) or (@ and !))', str(result))
예제 #10
0
    def test_empty(self):
        result = _parser._parse_text_rule('')

        self.assertIsInstance(result, _checks.TrueCheck)
예제 #11
0
 def test_A_or_B_and_C_or_D(self):
     result = _parser._parse_text_rule('@ or ! and @ or !')
     self.assertEqual('(@ or (! and @) or !)', str(result))
예제 #12
0
 def test_A_and_B_or_C_with_group_and_not_3(self):
     result = _parser._parse_text_rule('not ( @ and ! or @ )')
     self.assertEqual('not ((@ and !) or @)', str(result))
예제 #13
0
 def test_A_and_B_and_C_and_D(self):
     result = _parser._parse_text_rule('@ and ! and @ and !')
     self.assertEqual('(@ and ! and @ and !)', str(result))
예제 #14
0
    def test_empty(self):
        result = _parser._parse_text_rule('')

        self.assertTrue(isinstance(result, _checks.TrueCheck))
예제 #15
0
 def test_A_and_B_or_C_with_group_and_not_8(self):
     result = _parser._parse_text_rule('@ and ( ! or not @ )')
     self.assertEqual('(@ and (! or not @))', str(result))
예제 #16
0
 def test_A_and_B_or_C_with_group_and_not_3(self):
     result = _parser._parse_text_rule('not ( @ and ! or @ )')
     self.assertEqual('not ((@ and !) or @)', str(result))
예제 #17
0
 def test_A_and_B_or_C_with_not_3(self):
     result = _parser._parse_text_rule('@ and ! or not @')
     self.assertEqual('((@ and !) or not @)', str(result))
예제 #18
0
 def test_A_and_B_and_C_and_D(self):
     result = _parser._parse_text_rule('@ and ! and @ and !')
     self.assertEqual('(@ and ! and @ and !)', str(result))
예제 #19
0
 def test_A_and_B_or_C_with_not_3(self):
     result = _parser._parse_text_rule('@ and ! or not @')
     self.assertEqual('((@ and !) or not @)', str(result))
예제 #20
0
    def test_fail(self, mock_parse_tokenize):
        result = _parser._parse_text_rule('test rule')

        self.assertTrue(isinstance(result, _checks.FalseCheck))
        mock_parse_tokenize.assert_called_once_with('test rule')
예제 #21
0
 def test_A_and_B_or_C_with_group_and_not_8(self):
     result = _parser._parse_text_rule('@ and ( ! or not @ )')
     self.assertEqual('(@ and (! or not @))', str(result))
예제 #22
0
 def test_A_or_B_or_C(self):
     result = _parser._parse_text_rule('@ or ! or @')
     self.assertEqual('(@ or ! or @)', str(result))