Skip to content

Commit

Permalink
Guard against None cases in PublishData.to_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Oct 24, 2022
1 parent b3fa8e6 commit 2b89517
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/publish/publisher.py
Expand Up @@ -118,17 +118,19 @@ def to_dict(self, thousands_separator: str) -> Mapping[str, Any]:
d = self._as_dict()

# beautify cases, turn tuple-key into proper fields
d['cases'] = [{k: v for k, v in [('file_name', test[0]),
('class_name', test[1]),
('test_name', test[2]),
('states', states)]
if v}
for test, states in d['cases'].items()]
if d.get('cases'):
d['cases'] = [{k: v for k, v in [('file_name', test[0]),
('class_name', test[1]),
('test_name', test[2]),
('states', states)]
if v}
for test, states in d['cases'].items()]

# provide formatted stats and delta
d.update(formatted=self._formatted_stats_and_delta(
d.get('stats'), d.get('stats_with_delta'), thousands_separator
))

return d

def to_reduced_dict(self, thousands_separator: str) -> Mapping[str, Any]:
Expand Down

0 comments on commit 2b89517

Please sign in to comment.