Update sdk/platform-tools to version 26.0.0.
[android_tools.git] / sdk / platform-tools / systrace / catapult / telemetry / telemetry / internal / results / story_run.py
blob078d0fcb5ef8c73cc5bc272acfa5b7b7cb79f1d9
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from telemetry.value import failure
6 from telemetry.value import skip
9 class StoryRun(object):
10 def __init__(self, story):
11 self._story = story
12 self._values = []
14 def AddValue(self, value):
15 self._values.append(value)
17 @property
18 def story(self):
19 return self._story
21 @property
22 def values(self):
23 """The values that correspond to this story run."""
24 return self._values
26 @property
27 def ok(self):
28 """Whether the current run is still ok.
30 To be precise: returns true if there is neither FailureValue nor
31 SkipValue in self.values.
32 """
33 return not self.skipped and not self.failed
35 @property
36 def skipped(self):
37 """Whether the current run is being skipped.
39 To be precise: returns true if there is any SkipValue in self.values.
40 """
41 return any(isinstance(v, skip.SkipValue) for v in self.values)
43 @property
44 def failed(self):
45 """Whether the current run failed.
47 To be precise: returns true if there is a FailureValue but not
48 SkipValue in self.values.
49 """
50 return not self.skipped and any(
51 isinstance(v, failure.FailureValue) for v in self.values)