def test_base_binding_force(self): t = TestTarget() c = ObservableCollection(1,2,3,4,5,6,7,8,9,10) t << c c._Internal_Collection = ['a','b','c'] c.update_bindings() assert t.Values == ('a','b','c')
def test_base_binding_force(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t << c c._Internal_Collection = ['a', 'b', 'c'] c.update_bindings() assert t.Values == ('a', 'b', 'c')
def test_ItemAdded(self): c = ObservableCollection(1, 2, 3, 4) t = self.Tester() c.ItemAdded += t.handle_event c.add(1) assert t.Kwargs['collection'] == c assert t.Args == (1, 4)
def test_base_binding_force(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t < bind() < c c._internal_collection = ['a', 'b', 'c'] # don't do this in practice! c.update_bindings() assert t.values == ('a', 'b', 'c')
def test_ItemAdded(self): c = ObservableCollection(1,2,3,4) t = self.Tester() c.ItemAdded += t.handle_event c.add(1) assert t.Kwargs['collection'] == c assert t.Args == (1,4)
def test_base_binding_sort(self): t = TestTarget() c = ObservableCollection(1,2,3,4,5,6,7,8,9,10) t << c c.update_bindings() assert t.Values == (1,2,3,4,5,6,7,8,9,10) c.sort(reverse=True) assert t.Values == (10,9,8,7,6,5,4,3,2,1)
def test_base_binding_clear(self): t = TestTarget() c = ObservableCollection(1,2,3,4,5,6,7,8,9,10) t << c c.update_bindings() assert t.Values == (1,2,3,4,5,6,7,8,9,10) c.clear() assert t.Values == ()
def test_base_binding_sort(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t << c c.update_bindings() assert t.Values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) c.sort(reverse=True) assert t.Values == (10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
def test_base_binding_clear(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t << c c.update_bindings() assert t.Values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) c.clear() assert t.Values == ()
def test_base_binding_auto_update_remove(self): t = TestTarget() c = ObservableCollection(1,2,3,4,5,6,7,8,9,10) t << c c.remove(5) assert t.Values == (1,2,3,4,6,7,8,9,10)
def test_Reordered(self): c = ObservableCollection(5,8,2) t = self.Tester() c.Reordered += t.handle_event c.sort(reverse=True) assert t.Kwargs['collection'] == c
def test_base_binding_auto_update_add(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t < bind() < c c.add(11) assert t.values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
def test_iter(self): c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) result = [] for item in c: result.append(item) assert result == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def test_base_binding_auto_update_remove(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t << c c.remove(5) assert t.Values == (1, 2, 3, 4, 6, 7, 8, 9, 10)
def test_Reordered(self): c = ObservableCollection(5, 8, 2) t = self.Tester() c.Reordered += t.handle_event c.sort(reverse=True) assert t.Kwargs['collection'] == c
def test_CollectionChanged_remove(self): c = ObservableCollection(1,2,3,4,5,6,7,8,9,10) t = self.Tester() c.CollectionChanged += t.handle_event c.remove(1) assert t.Kwargs['collection'] == c
def test_CollectionChanged_remove(self): c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t = self.Tester() c.CollectionChanged += t.handle_event c.remove(1) assert t.Kwargs['collection'] == c
def test_base_binding(self): t = TestTarget() c = ObservableCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t < bind() < c t.update_bindings() assert t.values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)