Example #1
0
 def test_creation(self):
     sample = [1, 2, 3]
     d = types.MutableList(sample)
     self.assertEqual(sample, d)
Example #2
0
 def test_changed_on_append(self, mock_mutable_list_changed):
     sample = [1, 2, 3]
     lst = types.MutableList(sample)
     lst.append(4)
     self.assertEqual([1, 2, 3, 4], lst)
     self.assertEqual(1, mock_mutable_list_changed.call_count)
Example #3
0
 def test_changed_on_delitem(self, mock_mutable_list_changed):
     sample = [1, 2, 3]
     lst = types.MutableList(sample)
     del lst[2]
     self.assertEqual([1, 2], lst)
     self.assertEqual(1, mock_mutable_list_changed.call_count)
Example #4
0
 def test_coerce_mutable_list(self):
     sample = [1, 2, 3]
     sample_md = types.MutableList(sample)
     md = types.MutableList.coerce("test", sample_md)
     self.assertEqual(sample, md)
     self.assertIs(sample_md, md)