def _union(self, obj, exclude=None): """ Returns a union of all values as a set. """ u: Set[T] = set() for s in self.subsets: if s is exclude: continue tmp = s.__get__(obj) if tmp: try: u.update(tmp) except TypeError: # [0..1] property u.add(tmp) return collectionlist(u)
def _union(self, obj, exclude=None): """ Returns a union of all values as a set. """ if self.single: return next(iter(self.subsets)).__get__(obj) else: u = set() for s in self.subsets: if s is exclude: continue tmp = s.__get__(obj) if tmp: try: u.update(tmp) except TypeError: # [0..1] property u.add(tmp) return collectionlist(u)
def test_listing(self): c = collectionlist() c.append('a') c.append('b') c.append('c') assert str(c) == "['a', 'b', 'c']"
def test_listing(self): c = collectionlist() c.append("a") c.append("b") c.append("c") assert str(c) == "['a', 'b', 'c']"