Implement %u format specifier
New test function for the new SubredditPage._url_str() function added to test_subreddit.py. Being able to see the information this specifier adds makes it trivial to tell if a post is a Reddit crosspost from a SubredditPage (more trivial than manually parsing a full URL from %U, anyway).
This commit is contained in:
@@ -679,6 +679,24 @@ def test_subreddit_page__submission_attr(config, terminal, subreddit_page):
|
||||
terminal.attr.assert_called_with('SubmissionTitleSeen')
|
||||
|
||||
|
||||
def test_subreddit_page__url_str(config, terminal, subreddit_page):
|
||||
data = {
|
||||
'url_type': 'selfpost',
|
||||
'url': 'self.AskReddit',
|
||||
'url_full': 'https://www.reddit.com/r/AskReddit/comments/99eh6b/without_saying_what_the_category_is_what_are_your/'
|
||||
}
|
||||
|
||||
assert subreddit_page._url_str(data) == 'self.AskReddit'
|
||||
|
||||
data['url_type'] = 'x-post subreddit'
|
||||
|
||||
assert subreddit_page._url_str(data) == 'self.AskReddit'
|
||||
|
||||
data['url_type'] = 'external'
|
||||
|
||||
assert subreddit_page._url_str(data) == 'https://www.reddit.com/r/AskReddit/comments/99eh6b/without_saying_what_the_category_is_what_are_your/'
|
||||
|
||||
|
||||
def test_subreddit_page__url_attr(config, terminal, subreddit_page):
|
||||
data = {}
|
||||
data['url_full'] = 'www.test.com'
|
||||
|
||||
Reference in New Issue
Block a user