def addElement(self, position: int, element: Element) -> None: """ Add an element to the sequence. Overwrites previous values. Args: position (int): The sequence position of the element (lowest: 1) element (Element): An element instance Raises: ValueError: If the element has inconsistent durations """ # Validation element.validateDurations() # make a new copy of the element newelement = element.copy() # Data mutation self._data.update({position: newelement}) # insert default sequencing settings self._sequencing[position] = {'twait': 0, 'nrep': 1, 'jump_input': 0, 'jump_target': 0, 'goto': 0}
def test_copy(blueprint_tophat): elem1 = Element() elem1.addBluePrint(1, blueprint_tophat) elem2 = elem1.copy() assert elem1 == elem2