# Path: armet/query/parser.py
# COMBINATORS = {
#     constants.LOGICAL_AND: operator.and_,
#     constants.LOGICAL_OR: operator.or_}
# OPERATOR_BEGIN_CHARS = set(x[0] for _, x in constants.OPERATORS if x)
# OPERATOR_SYMBOL_MAP = dict((v, k) for k, v in constants.OPERATORS if v)
# OPERATOR_KEYWORDS = set(k for k, _ in constants.OPERATORS)
# REVERSED_OPERATOR_SUFFIX_MAP = dict(
#     (v, k) for k, v in constants.OPERATOR_SUFFIX_MAP.items()
# )
# class Query(object):
# class QuerySegment(object):
# class NoopQuerySegment(object):
# class BinarySegmentCombinator(object):
# class UnarySegmentCombinator(object):
#     def __init__(self, original, parsed):
#     def __init__(self, **kwargs):
#     def __repr__(self):
#     def __str__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, left, right, operation=operator.and_):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, operand, operation=operator.not_):
#     def __repr__(self):
#     def __str__(self):
# def parse(text, encoding='utf8'):
# def reset_stringio(buf):
# def split_segments(text, closing_paren=False):
# def combine(segments, combinators):
# def parse_directive(key):
# def parse_segment(text):
# 
# Path: armet/query/constants.py
# OPERATOR_EQUAL = 'exact', '=='
# OPERATOR_IEQUAL = 'iexact', '='
# OPERATOR_LT = 'lt', '<'
# OPERATOR_LTE = 'lte', '<='
# OPERATOR_GT = 'gt', '>'
# OPERATOR_GTE = 'gte', '>='
# OPERATOR_REGEX = 'regex', '*='
# OPERATOR_ISNULL = 'isnull', None
# OPERATOR_ICONTAINS = 'icontains', None
# OPERATOR_FALLBACK = OPERATOR_IEQUAL
# OPERATOR_SUFFIX_FALLBACK = OPERATOR_FALLBACK[0]
# OPERATOR_EQUALITY_FALLBACK = OPERATOR_FALLBACK[1]
# OPERATOR_MAP = {
#     OPERATOR_EQUAL: operator.eq,
#     OPERATOR_IEQUAL: lambda x, y: x.lower() == y.lower(),
#     OPERATOR_LT: operator.lt,
#     OPERATOR_LTE: operator.le,
#     OPERATOR_GT: operator.gt,
#     OPERATOR_GTE: operator.ge,
#     OPERATOR_REGEX: lambda x, y: re.search(y, x),
#     OPERATOR_ISNULL: lambda x: x is None,
#     OPERATOR_ICONTAINS: operator.contains,
# }
# OPERATORS = set(OPERATOR_MAP.keys())
# OPERATOR_SUFFIXES = set(filter(None, map(operator.itemgetter(0), OPERATORS)))
# OPERATOR_EQUALITIES = set(filter(None, map(operator.itemgetter(1), OPERATORS)))
# OPERATOR_SUFFIX_MAP = dict(
#     filter(operator.itemgetter(0),
#            map(lambda x: (x[0][0], x[1]),
#                OPERATOR_MAP.items())))
# OPERATOR_EQUALITY_MAP = dict(
#     filter(operator.itemgetter(0),
#            map(lambda x: (x[0][1], x[1]),
#                OPERATOR_MAP.items())))
# PATH_NEGATION = 'not'
# OPERATOR_NEGATION = '!'
# NEGATION = (PATH_NEGATION, OPERATOR_NEGATION)
# LOGICAL_AND = '&'
# LOGICAL_OR = ';'
# SEP_PATH = '.'
# SEP_VALUE = ','
# DIRECTIVE = ':'
# GROUP_BEGIN = '('
# GROUP_END = ')'


import unittest
import six
from armet.query import parser, constants
from pytest import mark
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division


@mark.bench('parser.parse', iterations=10000)
class QueryTestCase(unittest.TestCase):

    def parse(self, text):
        """Simple convenience function to unwrap the array of parameters."""
        return parser.parse(text).parsed

    def test_empty(self):
        """Test an empty query string."""
        item = self.parse('')


# Path: armet/query/parser.py
# COMBINATORS = {
#     constants.LOGICAL_AND: operator.and_,
#     constants.LOGICAL_OR: operator.or_}
# OPERATOR_BEGIN_CHARS = set(x[0] for _, x in constants.OPERATORS if x)
# OPERATOR_SYMBOL_MAP = dict((v, k) for k, v in constants.OPERATORS if v)
# OPERATOR_KEYWORDS = set(k for k, _ in constants.OPERATORS)
# REVERSED_OPERATOR_SUFFIX_MAP = dict(
#     (v, k) for k, v in constants.OPERATOR_SUFFIX_MAP.items()
# )
# class Query(object):
# class QuerySegment(object):
# class NoopQuerySegment(object):
# class BinarySegmentCombinator(object):
# class UnarySegmentCombinator(object):
#     def __init__(self, original, parsed):
#     def __init__(self, **kwargs):
#     def __repr__(self):
#     def __str__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, left, right, operation=operator.and_):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, operand, operation=operator.not_):
#     def __repr__(self):
#     def __str__(self):
# def parse(text, encoding='utf8'):
# def reset_stringio(buf):
# def split_segments(text, closing_paren=False):
# def combine(segments, combinators):
# def parse_directive(key):
# def parse_segment(text):
# 
# Path: armet/query/constants.py
# OPERATOR_EQUAL = 'exact', '=='
# OPERATOR_IEQUAL = 'iexact', '='
# OPERATOR_LT = 'lt', '<'
# OPERATOR_LTE = 'lte', '<='
# OPERATOR_GT = 'gt', '>'
# OPERATOR_GTE = 'gte', '>='
# OPERATOR_REGEX = 'regex', '*='
# OPERATOR_ISNULL = 'isnull', None
# OPERATOR_ICONTAINS = 'icontains', None
# OPERATOR_FALLBACK = OPERATOR_IEQUAL
# OPERATOR_SUFFIX_FALLBACK = OPERATOR_FALLBACK[0]
# OPERATOR_EQUALITY_FALLBACK = OPERATOR_FALLBACK[1]
# OPERATOR_MAP = {
#     OPERATOR_EQUAL: operator.eq,
#     OPERATOR_IEQUAL: lambda x, y: x.lower() == y.lower(),
#     OPERATOR_LT: operator.lt,
#     OPERATOR_LTE: operator.le,
#     OPERATOR_GT: operator.gt,
#     OPERATOR_GTE: operator.ge,
#     OPERATOR_REGEX: lambda x, y: re.search(y, x),
#     OPERATOR_ISNULL: lambda x: x is None,
#     OPERATOR_ICONTAINS: operator.contains,
# }
# OPERATORS = set(OPERATOR_MAP.keys())
# OPERATOR_SUFFIXES = set(filter(None, map(operator.itemgetter(0), OPERATORS)))
# OPERATOR_EQUALITIES = set(filter(None, map(operator.itemgetter(1), OPERATORS)))
# OPERATOR_SUFFIX_MAP = dict(
#     filter(operator.itemgetter(0),
#            map(lambda x: (x[0][0], x[1]),
#                OPERATOR_MAP.items())))
# OPERATOR_EQUALITY_MAP = dict(
#     filter(operator.itemgetter(0),
#            map(lambda x: (x[0][1], x[1]),
#                OPERATOR_MAP.items())))
# PATH_NEGATION = 'not'
# OPERATOR_NEGATION = '!'
# NEGATION = (PATH_NEGATION, OPERATOR_NEGATION)
# LOGICAL_AND = '&'
# LOGICAL_OR = ';'
# SEP_PATH = '.'
# SEP_VALUE = ','
# DIRECTIVE = ':'
# GROUP_BEGIN = '('
# GROUP_END = ')'


# Path: tests/test_query.py
import unittest
import six
from armet.query import parser, constants
from pytest import mark

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division


@mark.bench('parser.parse', iterations=10000)
class QueryTestCase(unittest.TestCase):

    def parse(self, text):
        """Simple convenience function to unwrap the array of parameters."""
        return parser.parse(text).parsed

    def test_empty(self):
        """Test an empty query string."""
        item = self.parse('')


        assert isinstance(item, parser.NoopQuerySegment)