# Path: monasca_api/expression_parser/alarm_expr_parser.py
# _DETERMINISTIC_ASSIGNMENT_LEN = 3
# _DETERMINISTIC_ASSIGNMENT_SHORT_LEN = 1
# _DETERMINISTIC_ASSIGNMENT_VALUE_INDEX = 2
# _DEFAULT_PERIOD = 60
# _DEFAULT_PERIODS = 1
# COMMA = pyparsing.Suppress(pyparsing.Literal(","))
# LPAREN = pyparsing.Suppress(pyparsing.Literal("("))
# RPAREN = pyparsing.Suppress(pyparsing.Literal(")"))
# EQUAL = pyparsing.Literal("=")
# LBRACE = pyparsing.Suppress(pyparsing.Literal("{"))
# RBRACE = pyparsing.Suppress(pyparsing.Literal("}"))
# MINUS = pyparsing.Literal('-')
# AND = pyparsing.CaselessLiteral("and") | pyparsing.CaselessLiteral("&&")
# OR = pyparsing.CaselessLiteral("or") | pyparsing.CaselessLiteral("||")
# class SubExpr(object):
# class BinaryOp(object):
# class AndSubExpr(BinaryOp):
# class OrSubExpr(BinaryOp):
# class AlarmExprParser(object):
#     def __init__(self, tokens):
#     def fmtd_sub_expr_str(self):
#     def dimensions_str(self):
#     def operands_list(self):
#     def func(self):
#     def normalized_func(self):
#     def metric_name(self):
#     def normalized_metric_name(self):
#     def dimensions(self):
#     def dimensions_as_list(self):
#     def operator(self):
#     def threshold(self):
#     def period(self):
#     def periods(self):
#     def deterministic(self):
#     def normalized_operator(self):
#     def id(self):
#     def id(self, id):
#     def __init__(self, tokens):
#     def operands_list(self):
# def periodValidation(instr, loc, tokens):
# def periodsValidation(instr, loc, tokens):
#     def __init__(self, expr):
#     def sub_expr_list(self):
# def main():


import pyparsing
from monasca_api.expression_parser import alarm_expr_parser
from monasca_api.tests import base
        self.assertEqual([x.dimensions_as_list for x in sub_exprs].__str__(),
                         "[ParseResults(['hostname=fred'], {}), [], []]")

    def test_operator(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.operator for x in sub_exprs], ['<=', '<', 'gte'])

    def test_threshold(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.threshold for x in sub_exprs], [3.0, 5.0, 3.0])

    def test_period(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.period for x in sub_exprs], [60, 60, 60])

    def test_periods(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.periods for x in sub_exprs], [4, 1, 1])

    def test_deterministic(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.deterministic for x in sub_exprs], [False, False, True])

    def test_normalized_operator(self):
        expression = self.good_simple_expression

# Path: monasca_api/expression_parser/alarm_expr_parser.py
# _DETERMINISTIC_ASSIGNMENT_LEN = 3
# _DETERMINISTIC_ASSIGNMENT_SHORT_LEN = 1
# _DETERMINISTIC_ASSIGNMENT_VALUE_INDEX = 2
# _DEFAULT_PERIOD = 60
# _DEFAULT_PERIODS = 1
# COMMA = pyparsing.Suppress(pyparsing.Literal(","))
# LPAREN = pyparsing.Suppress(pyparsing.Literal("("))
# RPAREN = pyparsing.Suppress(pyparsing.Literal(")"))
# EQUAL = pyparsing.Literal("=")
# LBRACE = pyparsing.Suppress(pyparsing.Literal("{"))
# RBRACE = pyparsing.Suppress(pyparsing.Literal("}"))
# MINUS = pyparsing.Literal('-')
# AND = pyparsing.CaselessLiteral("and") | pyparsing.CaselessLiteral("&&")
# OR = pyparsing.CaselessLiteral("or") | pyparsing.CaselessLiteral("||")
# class SubExpr(object):
# class BinaryOp(object):
# class AndSubExpr(BinaryOp):
# class OrSubExpr(BinaryOp):
# class AlarmExprParser(object):
#     def __init__(self, tokens):
#     def fmtd_sub_expr_str(self):
#     def dimensions_str(self):
#     def operands_list(self):
#     def func(self):
#     def normalized_func(self):
#     def metric_name(self):
#     def normalized_metric_name(self):
#     def dimensions(self):
#     def dimensions_as_list(self):
#     def operator(self):
#     def threshold(self):
#     def period(self):
#     def periods(self):
#     def deterministic(self):
#     def normalized_operator(self):
#     def id(self):
#     def id(self, id):
#     def __init__(self, tokens):
#     def operands_list(self):
# def periodValidation(instr, loc, tokens):
# def periodsValidation(instr, loc, tokens):
#     def __init__(self, expr):
#     def sub_expr_list(self):
# def main():


# Path: monasca_api/tests/test_alarm_expression.py
import pyparsing
from monasca_api.expression_parser import alarm_expr_parser
from monasca_api.tests import base

        self.assertEqual([x.dimensions_as_list for x in sub_exprs].__str__(),
                         "[ParseResults(['hostname=fred'], {}), [], []]")

    def test_operator(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.operator for x in sub_exprs], ['<=', '<', 'gte'])

    def test_threshold(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.threshold for x in sub_exprs], [3.0, 5.0, 3.0])

    def test_period(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.period for x in sub_exprs], [60, 60, 60])

    def test_periods(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.periods for x in sub_exprs], [4, 1, 1])

    def test_deterministic(self):
        expression = self.good_simple_expression
        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
        self.assertEqual([x.deterministic for x in sub_exprs], [False, False, True])

    def test_normalized_operator(self):
        expression = self.good_simple_expression

        sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list