Updated a few tests.
This commit is contained in:
@@ -101,7 +101,8 @@ def test_content_submission(reddit, terminal):
|
|||||||
assert content.get(40)['type'] == 'Comment'
|
assert content.get(40)['type'] == 'Comment'
|
||||||
|
|
||||||
for data in content.iterate(-1, 1):
|
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
|
# All text should be converted to unicode by this point
|
||||||
for val in data.values():
|
for val in data.values():
|
||||||
assert not isinstance(val, six.binary_type)
|
assert not isinstance(val, six.binary_type)
|
||||||
@@ -121,11 +122,14 @@ def test_content_submission(reddit, terminal):
|
|||||||
data = content.get(2)
|
data = content.get(2)
|
||||||
assert data['type'] == 'HiddenComment'
|
assert data['type'] == 'HiddenComment'
|
||||||
assert data['count'] == 3
|
assert data['count'] == 3
|
||||||
|
assert data['hidden'] is True
|
||||||
assert data['level'] >= content.get(3)['level']
|
assert data['level'] >= content.get(3)['level']
|
||||||
assert len(content._comment_data) == 43
|
assert len(content._comment_data) == 43
|
||||||
|
|
||||||
# Toggling again expands the children
|
# Toggling again expands the children
|
||||||
content.toggle(2)
|
content.toggle(2)
|
||||||
|
data = content.get(2)
|
||||||
|
assert data['hidden'] is False
|
||||||
assert len(content._comment_data) == 45
|
assert len(content._comment_data) == 45
|
||||||
|
|
||||||
|
|
||||||
@@ -195,8 +199,9 @@ def test_content_subreddit(reddit, terminal):
|
|||||||
assert content.get(0)['type'] == 'Submission'
|
assert content.get(0)['type'] == 'Submission'
|
||||||
|
|
||||||
for data in content.iterate(0, 1):
|
for data in content.iterate(0, 1):
|
||||||
assert all(k in data for k in ('object', 'n_rows', 'offset', 'type',
|
assert all(k in data for k in (
|
||||||
'index', 'title', 'split_title'))
|
'object', 'n_rows', 'offset', 'type', 'index', 'title',
|
||||||
|
'split_title', 'hidden'))
|
||||||
# All text should be converted to unicode by this point
|
# All text should be converted to unicode by this point
|
||||||
for val in data.values():
|
for val in data.values():
|
||||||
assert not isinstance(val, six.binary_type)
|
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['index'] == i + 1
|
||||||
assert data['title'].startswith(six.text_type(i + 1))
|
assert data['title'].startswith(six.text_type(i + 1))
|
||||||
|
|
||||||
|
|
||||||
def test_content_subreddit_from_name(reddit, terminal):
|
def test_content_subreddit_from_name(reddit, terminal):
|
||||||
|
|
||||||
name = '/r/python'
|
name = '/r/python'
|
||||||
|
|||||||
@@ -346,11 +346,13 @@ def test_objects_navigator_properties():
|
|||||||
assert nav.step == 1
|
assert nav.step == 1
|
||||||
assert nav.position == (0, 0, False)
|
assert nav.position == (0, 0, False)
|
||||||
assert nav.absolute_index == 0
|
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.step == -1
|
||||||
assert nav.position == (5, 2, True)
|
assert nav.position == (5, 2, True)
|
||||||
assert nav.absolute_index == 3
|
assert nav.absolute_index == 3
|
||||||
|
assert nav.top_item_height == 10
|
||||||
|
|
||||||
|
|
||||||
def test_objects_navigator_move():
|
def test_objects_navigator_move():
|
||||||
@@ -360,6 +362,7 @@ def test_objects_navigator_move():
|
|||||||
raise IndexError()
|
raise IndexError()
|
||||||
|
|
||||||
nav = Navigator(valid_page_cb)
|
nav = Navigator(valid_page_cb)
|
||||||
|
nav.top_item_height = 5
|
||||||
|
|
||||||
# Try to scroll up past the first item
|
# Try to scroll up past the first item
|
||||||
valid, redraw = nav.move(-1, 2)
|
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
|
# Scroll down, reach last item on the page and flip the screen
|
||||||
valid, redraw = nav.move(1, 3)
|
valid, redraw = nav.move(1, 3)
|
||||||
|
assert nav.top_item_height is None
|
||||||
assert nav.page_index == 2
|
assert nav.page_index == 2
|
||||||
assert nav.cursor_index == 0
|
assert nav.cursor_index == 0
|
||||||
assert nav.inverted
|
assert nav.inverted
|
||||||
|
|||||||
Reference in New Issue
Block a user