adapt listview selection test to new behavior

This commit is contained in:
dessant 2016-02-18 19:08:33 +02:00
parent d338fca047
commit 24f4b605b2
1 changed files with 6 additions and 7 deletions

View File

@ -407,18 +407,17 @@ class ListAdapterTestCase(unittest.TestCase):
# Now unselect it with handle_selection().
list_adapter.handle_selection(banana)
self.assertFalse(banana.is_selected)
# But, since we have allow_empty_selection=False, Apple will be
# reselected.
self.assertEqual(selection_observer.fruit_name, 'Apple')
# But, since we have allow_empty_selection=False, Banana will stay
# selected, behavior changed in #3672.
self.assertEqual(selection_observer.fruit_name, 'Banana')
# Call count:
#
# Apple got selected initally (0), then unselected when Banana was
# selected (1). Then banana was unselected, causing reselection of
# Apple (3). len should be 1.
self.assertEqual(selection_observer.call_count, 3)
# selected (1). Then banana was unselected (2), and stayed selected.
# len should be 1.
self.assertEqual(selection_observer.call_count, 2)
self.assertEqual(len(list_adapter.selection), 1)