Updated a few tests.

This commit is contained in:
Michael Lazar
2016-04-20 00:06:22 -07:00
parent aa065c6e29
commit 51a0dd33e4
2 changed files with 14 additions and 4 deletions

View File

@@ -101,7 +101,8 @@ def test_content_submission(reddit, terminal):
assert content.get(40)['type'] == 'Comment'
for data in content.iterate(-1, 1):
assert all(k in data for k in ('object', 'n_rows', 'offset', 'type'))
assert all(k in data for k in ('object', 'n_rows', 'offset', 'type',
'hidden'))
# All text should be converted to unicode by this point
for val in data.values():
assert not isinstance(val, six.binary_type)
@@ -121,11 +122,14 @@ def test_content_submission(reddit, terminal):
data = content.get(2)
assert data['type'] == 'HiddenComment'
assert data['count'] == 3
assert data['hidden'] is True
assert data['level'] >= content.get(3)['level']
assert len(content._comment_data) == 43
# Toggling again expands the children
content.toggle(2)
data = content.get(2)
assert data['hidden'] is False
assert len(content._comment_data) == 45
@@ -195,8 +199,9 @@ def test_content_subreddit(reddit, terminal):
assert content.get(0)['type'] == 'Submission'
for data in content.iterate(0, 1):
assert all(k in data for k in ('object', 'n_rows', 'offset', 'type',
'index', 'title', 'split_title'))
assert all(k in data for k in (
'object', 'n_rows', 'offset', 'type', 'index', 'title',
'split_title', 'hidden'))
# All text should be converted to unicode by this point
for val in data.values():
assert not isinstance(val, six.binary_type)
@@ -227,6 +232,7 @@ def test_content_subreddit_load_more(reddit, terminal):
assert data['index'] == i + 1
assert data['title'].startswith(six.text_type(i + 1))
def test_content_subreddit_from_name(reddit, terminal):
name = '/r/python'

View File

@@ -346,11 +346,13 @@ def test_objects_navigator_properties():
assert nav.step == 1
assert nav.position == (0, 0, False)
assert nav.absolute_index == 0
assert nav.top_item_height is None
nav = Navigator(valid_page_cb, 5, 2, True)
nav = Navigator(valid_page_cb, 5, 2, True, 10)
assert nav.step == -1
assert nav.position == (5, 2, True)
assert nav.absolute_index == 3
assert nav.top_item_height == 10
def test_objects_navigator_move():
@@ -360,6 +362,7 @@ def test_objects_navigator_move():
raise IndexError()
nav = Navigator(valid_page_cb)
nav.top_item_height = 5
# Try to scroll up past the first item
valid, redraw = nav.move(-1, 2)
@@ -375,6 +378,7 @@ def test_objects_navigator_move():
# Scroll down, reach last item on the page and flip the screen
valid, redraw = nav.move(1, 3)
assert nav.top_item_height is None
assert nav.page_index == 2
assert nav.cursor_index == 0
assert nav.inverted