def part2regulatory_elements(): # regulatory elements profit from pythons type system lanelet = get_a_lanelet() light = get_linestring_at_y(3) regelem = TrafficLight(getId(), AttributeMap(), [light]) lanelet.addRegulatoryElement(regelem) assert regelem in lanelet.regulatoryElements lights = [regelem for regelem in lanelet.regulatoryElements if isinstance(regelem, TrafficLight)] assert regelem in lights assert light in lights[0].trafficLights
def getRegelem(): return TrafficLight(getId(), AttributeMap(), [getLineString()], getLineString())