def test_shifts(self, mock_shift, mock_parse_tokenize): result = policy._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')])
def test_fail(self, mock_parse_tokenize): result = policy._parse_text_rule('test rule') self.assertTrue(isinstance(result, policy.FalseCheck)) mock_parse_tokenize.assert_called_once_with('test rule')
def test_empty(self): result = policy._parse_text_rule('') self.assertTrue(isinstance(result, policy.TrueCheck))