示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 def test_listing(self):
     c = collectionlist()
     c.append('a')
     c.append('b')
     c.append('c')
     assert str(c) == "['a', 'b', 'c']"
示例#4
0
 def test_listing(self):
     c = collectionlist()
     c.append("a")
     c.append("b")
     c.append("c")
     assert str(c) == "['a', 'b', 'c']"