def test_filter(self): t = TestTarget() c = ViewCollection(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) t << c t.update_bindings() assert t.Values == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) c.update_filter(lambda x: x % 2 == 0) assert t.Values == (2, 4, 6, 8, 10)
def test_filter(self): t = TestTarget() c = ViewCollection(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) c.update_filter(lambda x: x % 2 == 0) assert t.values == (2, 4, 6, 8, 10)
def test_ViewChanged (self): v = ViewCollection(5,8,2) t = self.Tester() v.ViewChanged += t.handle_event v.update_filter(lambda x : x < 5) assert t.Kwargs['collection'] == v
def test_ViewChanged(self): v = ViewCollection(5, 8, 2) t = self.Tester() v.ViewChanged += t.handle_event v.update_filter(lambda x: x < 5) assert t.Kwargs['collection'] == v
def test_ViewChanged(self): v = ViewCollection(5, 8, 2, synchronous=True) t = self.Tester() v.onViewChanged += t.handle_event v.update_filter(lambda x: x < 5) assert t.kwargs['collection'] == v