def test_containerWhereAllElementsAreKnown(self): """ A L{crefutil._Container} where all of its elements are known at construction time is nonsensical and will result in errors in any call to addDependant. """ container = crefutil._Container([1, 2, 3], list) self.assertRaises(AssertionError, container.addDependant, {}, "ignore-me")
def _unjellySetOrFrozenset(self, lst, containerType): """ Helper method to unjelly set or frozenset. @param lst: the content of the set. @type lst: C{list} @param containerType: the type of C{set} to use. """ l = range(len(lst)) finished = True for elem in l: data = self.unjellyInto(l, elem, lst[elem]) if isinstance(data, NotKnown): finished = False if not finished: return _Container(l, containerType) else: return containerType(l)