def __init__(self, tag_pattern, name=None, critical=True, doc='', links=None): TagStat.__init__(self, name or unicode(tag_pattern), doc, links, critical=critical, non_critical=not critical) self.pattern = tag_pattern
def get_attributes(self, include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False): attrs = {'pass': self.passed, 'fail': self.failed} attrs.update(self._get_custom_attrs()) if include_label: attrs['label'] = self.name if include_elapsed: attrs['elapsed'] = elapsed_time_to_string(self.elapsed, include_millis=False) if exclude_empty: attrs = dict((k, v) for k, v in attrs.items() if v not in ('', None)) if values_as_strings: attrs = dict((k, unicode(v if v is not None else '')) for k, v in attrs.items()) if html_escape: attrs = dict((k, self._html_escape(v)) for k, v in attrs.items()) return attrs
def get_attributes(self, include_label=False, include_elapsed=False, exclude_empty=True, values_as_strings=False, html_escape=False): attrs = {'pass': self.passed, 'fail': self.failed} attrs.update(self._get_custom_attrs()) if include_label: attrs['label'] = self.name if include_elapsed: attrs['elapsed'] = elapsed_time_to_string(self.elapsed, include_millis=False) if exclude_empty: attrs = dict( (k, v) for k, v in attrs.items() if v not in ('', None)) if values_as_strings: attrs = dict((k, unicode(v if v is not None else '')) for k, v in attrs.items()) if html_escape: attrs = dict((k, self._html_escape(v)) for k, v in attrs.items()) return attrs
def __unicode__(self): return unicode(self.value or '')
def __unicode__(self): return u'[%s]' % ', '.join(unicode(item) for item in self)
def _get_critical_and_non_critical_matcher(self): crits = [stat for stat in self.critical + self.non_critical if isinstance(stat.pattern, SingleTagPattern)] return NormalizedDict([(unicode(stat.pattern), None) for stat in crits], ignore='_')
def _get_critical_stat(self, pattern, critical): name = unicode(pattern) return CriticalTagStat(pattern, name, critical, self.get_doc(name), self.get_links(name))