def _process_frame_event(self, event):
        attributes = event[c.ATTRIBUTES_KEY]
        framed_event = None
        while True:
            line = self.next_line()
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_END].match(line)
            if m:
                if m.group(c.FRAME_NAME_KEY) != attributes[c.FRAME_NAME_KEY]:
                    self.logger.warning(
                        "The QStart:NAME != QEnd:NAME (%s != %s)",
                        m.group(c.FRAME_NAME_KEY),
                        attributes[c.FRAME_NAME_KEY],
                    )
                break
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_DEFAULT].match(line)
            if m:
                attributes[c.DEFAULT_KEY] = m.group(c.DEFAULT_KEY)
                continue
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_HIDDEN].match(line)
            if m:
                if m.group(c.HIDDEN_KEY) == "TRUE":
                    attributes[c.HIDDEN_KEY] = True
                elif m.group(c.HIDDEN_KEY) == "FALSE":
                    attributes[c.HIDDEN_KEY] = False
                else:
                    self.logger.warning(
                        "The QHidden(%s) has invalid option: "
                        "%s not in (TRUE, FALSE)",
                        attributes[c.FRAME_NAME_KEY],
                        m.group(c.HIDDEN_KEY),
                    )
                    attributes[c.HIDDEN_KEY] = False
                continue
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_VALID_VALUES].match(
                line)
            if m:
                attributes[c.VALID_VALUES_KEY] = utils.split_valid_options(
                    m.group('valid'))
                continue

            framed_event = self._next_event(line)
            if framed_event is None:
                raise errors.UnexpectedInputError(
                    c.QUERY_FRAME_EVENT,
                    attributes,
                    line,
                )

            event[c.ATTRIBUTES_KEY].update(framed_event[c.ATTRIBUTES_KEY])
            event[c.TYPE_KEY] = framed_event[c.TYPE_KEY]

        if framed_event is None:
            raise errors.IncompleteQueryFrameError(
                "The frame %s doesn't contain query.",
                event,
            )
    def _process_frame_event(self, event):
        attributes = event[c.ATTRIBUTES_KEY]
        framed_event = None
        while True:
            line = self.next_line()
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_END].match(line)
            if m:
                if m.group(c.FRAME_NAME_KEY) != attributes[c.FRAME_NAME_KEY]:
                    self.logger.warning(
                        "The QStart:NAME != QEnd:NAME (%s != %s)",
                        m.group(c.FRAME_NAME_KEY),
                        attributes[c.FRAME_NAME_KEY],
                    )
                break
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_DEFAULT].match(line)
            if m:
                attributes[c.DEFAULT_KEY] = m.group(c.DEFAULT_KEY)
                continue
            m = c.QUERY_FRAME_PATTERNS[c.QUERY_FRAME_PART_HIDDEN].match(line)
            if m:
                if m.group(c.HIDDEN_KEY) == "TRUE":
                    attributes[c.HIDDEN_KEY] = True
                elif m.group(c.HIDDEN_KEY) == "FALSE":
                    attributes[c.HIDDEN_KEY] = False
                else:
                    self.logger.warning(
                        "The QHidden(%s) has invalid option: "
                        "%s not in (TRUE, FALSE)",
                        attributes[c.FRAME_NAME_KEY],
                        m.group(c.HIDDEN_KEY),
                    )
                    attributes[c.HIDDEN_KEY] = False
                continue
            m = c.QUERY_FRAME_PATTERNS[
                c.QUERY_FRAME_PART_VALID_VALUES
            ].match(line)
            if m:
                attributes[c.VALID_VALUES_KEY] = utils.split_valid_options(
                    m.group('valid')
                )
                continue

            framed_event = self._next_event(line)
            if framed_event is None:
                raise errors.UnexpectedInputError(
                    c.QUERY_FRAME_EVENT, attributes, line,
                )

            event[c.ATTRIBUTES_KEY].update(framed_event[c.ATTRIBUTES_KEY])
            event[c.TYPE_KEY] = framed_event[c.TYPE_KEY]

        if framed_event is None:
            raise errors.IncompleteQueryFrameError(
                "The frame %s doesn't contain query.",
                event,
            )
def test_negative_case():
    with pytest.raises(ValueError) as ex:
        split_valid_options("abc\\def|foobar")
    assert "Unescaped" in str(ex.value)
def test_split_function(string, expected_options):
    options = split_valid_options(string)
    assert options == expected_options
def test_negative_case():
    with pytest.raises(ValueError) as ex:
        split_valid_options("abc\\def|foobar")
    assert "Unescaped" in str(ex.value)
def test_split_function(string, expected_options):
    options = split_valid_options(string)
    assert options == expected_options