コード例 #1
0
 def test_ShadowedList__reverse__values_and_shadow_values_identical(self):
     # ShadowList.reverse() works also when passed the same
     # sequence as values and as shadow_values.
     list_ = range(3)
     shadow_list = ShadowedList(list_, list_)
     shadow_list.reverse()
     self.assertEqual(0, shadow_list[-1])
     self.assertEqual(2, shadow_list[0])
     self.assertEqual(0, shadow_list.shadow_values[-1])
     self.assertEqual(2, shadow_list.shadow_values[0])
コード例 #2
0
 def test_ShadowedList__reverse(self):
     # ShadowList.reverse() reverses its elements.
     list1 = range(3)
     list2 = self.makeStringSequence(list1)
     first1 = list1[0]
     last1 = list1[-1]
     first2 = list2[0]
     last2 = list2[-1]
     shadow_list = ShadowedList(list1, list2)
     shadow_list.reverse()
     self.assertEqual(first1, shadow_list[-1])
     self.assertEqual(last1, shadow_list[0])
     self.assertEqual(first2, shadow_list.shadow_values[-1])
     self.assertEqual(last2, shadow_list.shadow_values[0])