Пример #1
0
    def eval(self, step_collection):
        for step in step_collection.steps:
            loc = step.current_location

            if (loc.path == self.path and loc.lineno in self.line_range):
                try:
                    watch = step.program_state.frames[0].watches[
                        self.expression]
                except KeyError:
                    pass
                else:
                    expected_field = self._get_expected_field(watch)
                    step_info = StepValueInfo(step.step_index, watch,
                                              expected_field)
                    self._handle_watch(step_info)

        if self._require_in_order:
            # A list of all watches where the value has changed.
            value_change_watches = []
            prev_value = None
            for watch in self.expected_watches:
                if watch.expected_value != prev_value:
                    value_change_watches.append(watch)
                    prev_value = watch.expected_value

            self.misordered_watches = self._check_watch_order(
                value_change_watches, [
                    v for v in self.values
                    if v in [w.expected_value for w in self.expected_watches]
                ])
Пример #2
0
    def eval(self, step_collection):
        for step in step_collection.steps:
            loc = step.current_location

            if (loc.path and self.path
                    and PurePath(loc.path) == PurePath(self.path)
                    and loc.lineno in self.line_range):
                try:
                    watch = step.program_state.frames[0].watches[
                        self.expression]
                except KeyError:
                    pass
                else:
                    expected_field = self._get_expected_field(watch)
                    step_info = StepValueInfo(step.step_index, watch,
                                              expected_field)
                    self._handle_watch(step_info)

        if self._require_in_order:
            # A list of all watches where the value has changed.
            value_change_watches = []
            prev_value = None
            all_expected_values = []
            for watch in self.expected_watches:
                expected_value = self._maybe_fix_float(watch.expected_value)
                all_expected_values.append(expected_value)
                if expected_value != prev_value:
                    value_change_watches.append(watch)
                    prev_value = expected_value

            resolved_values = [self.resolve_value(v) for v in self.values]
            self.misordered_watches = self._check_watch_order(
                value_change_watches,
                [v for v in resolved_values if v in all_expected_values])