def test_instance_location_from_label(map_doc): inst = InstanceDescriptor(locationLabel="Wonky") assert inst.getFullUserLocation(map_doc) == { "Weight": 800, "Width": 100, "Custom": 1.2, }, "an instance with a locationLabel uses the user location from that label, empty values on the label use axis defaults" assert inst.getFullDesignLocation(map_doc) == { "Weight": 80, "Width": 10000, "Custom": 1.2, }, "an instance with a locationLabel computes the design location from that label, empty values on the label use axis defaults" inst = InstanceDescriptor(locationLabel="Wonky", userLocation={"Width": 200}) assert inst.getFullUserLocation(map_doc) == { "Weight": 800, "Width": 100, "Custom": 1.2, }, "an instance with a locationLabel uses the user location from that label, other location values are ignored" assert inst.getFullDesignLocation(map_doc) == { "Weight": 80, "Width": 10000, "Custom": 1.2, }, "an instance with a locationLabel computes the design location from that label, other location values are ignored"
def test_instance_location_no_data(map_doc): inst = InstanceDescriptor() assert inst.getFullUserLocation(map_doc) == { "Weight": 100, "Width": 100, "Custom": 1.5, }, "an instance without any location data has the default user location" assert inst.getFullDesignLocation(map_doc) == { "Weight": 10, "Width": 10000, "Custom": 1.5, }, "an instance without any location data has the default design location"
def test_instance_location_mix(map_doc): inst = InstanceDescriptor( designLocation={"Weight": (60, 61)}, userLocation={"Width": 180}, ) assert inst.getFullUserLocation(map_doc) == { "Weight": 600, "Width": 180, "Custom": 1.5, }, "instance location is a mix of design and user locations" assert inst.getFullDesignLocation(map_doc) == { "Weight": (60, 61), "Width": 18000, "Custom": 1.5, }, "instance location is a mix of design and user location"
def test_instance_location_design_first(map_doc): inst = InstanceDescriptor( designLocation={ "Weight": (60, 61), "Width": 11000, "Custom": 1.2 }, userLocation={ "Weight": 700, "Width": 180, "Custom": 1.4 }, ) assert inst.getFullUserLocation(map_doc) == { "Weight": 600, "Width": 110, "Custom": 1.2, }, "when both design and user location data are provided, design wins" assert inst.getFullDesignLocation(map_doc) == { "Weight": (60, 61), "Width": 11000, "Custom": 1.2, }, "when both design and user location data are provided, design wins (incl. anisotropy)"