def __init__(self, items, string): Delegator.__init__(self, string) self.NormalAttribute = "default" self._x = None self._constant = "c" for i in items: self.append(i)
def test_copy(self): """copy.copy should work correctly on Delegator""" l = ["a"] d = Delegator(l) c = copy(d) assert c is not d assert c._handler is d._handler
def test_deepcopy(self): """copy.deepcopy should work correctly on Delegator""" l = ["a"] d = Delegator(l) c = deepcopy(d) assert c is not d assert c._handler is not d._handler assert c._handler == d._handler
def __init__(self, *args, **kwargs): """Returns new Info object. Creates DbRefs if necessary.""" temp = dict(*args, **kwargs) if "Refs" in temp: refs = temp["Refs"] if not isinstance(refs, DbRefs): refs = DbRefs(refs) else: refs = DbRefs() # move keys into refs if they belong there: allows init from flat dict for key, val in list(temp.items()): if key in KnownDatabases: refs[key] = val del temp[key] Delegator.__init__(self, refs) self["Refs"] = refs MappedRecord.__init__(self, temp)