Simplify score and comment count data

This commit changes the functionality of the Content class (and its
subclasses) by removing the text from the comments and score fields of
Reddit data dictionaries created by Content.strip*.  data['comments'] is
now an integer, but data['score'] remains a string to preserve using '-'
when the score is hidden.

It is now the responsibility of wherever this data is used to provide
the extra text that these variables used to include, and modifications
have been made to the Submission and Subreddit classes to preserve the
previous way the data was displayed.

Tests modified to expect these changes.
This commit is contained in:
John Helmert
2019-07-29 19:10:26 -05:00
parent 9e43d7ed65
commit 8df2df93f6
4 changed files with 15 additions and 14 deletions

View File

@@ -736,9 +736,9 @@ def test_subreddit_page__create_format(terminal, subreddit_page):
data = {
'index': '1',
'title': 'Without saying what the category is, what are your top five?',
'score': '144655 pts',
'score': '144655',
'likes': True,
'comments': '26584 comments',
'comments': '26584',
'created': '10month',
'edited': '(edit 5month)',
'author': 'reddit_user',
@@ -858,7 +858,8 @@ def test_subreddit_page__create_format(terminal, subreddit_page):
assert format_list[6][0](data) == expected_str['%n'] + ' '
else:
# General case
assert format_list[1][0](data) == expected_str[fmt]
assert format_list[1][0](data) == expected_str[fmt], \
"On specifier {0}".format(fmt)
format_list[1][1](data)
terminal.attr.assert_called_with(expected_attr[fmt])