def test_BarcodedSbsLabware_validate_does_not_autopopulate_LabwareDefinition_if_flagged( mocker, ): m = BarcodedSbsLabware(**GENERIC_BARCODED_SBS_LABWARE_KWARGS) mocker.spy(m.labware_definition, "autopopulate") m.validate(autopopulate=False) assert m.labware_definition.autopopulate.call_count == 0
def test_BarcodedSbsLabware__validate_hash_components_calls_super__and_raises_error_if_invalid_id( mocker, ): spied_validate = mocker.spy(DomainModel, "validate_hash_components") with pytest.raises(ValidationCollectionEmptyValueError) as e: BarcodedSbsLabware().validate_hash_components(autopopulate=False) assert "uuid" in str(e) assert spied_validate.call_count == 1
def test_BarcodedSbsLabware__hash__hashes_uuid(): m = BarcodedSbsLabware(uuid=GENERIC_UUID) assert hash(m) == hash((GENERIC_UUID,))
def test_BarcodedSbsLabware_super_is_called_during_init(mocker): mocked_init = mocker.patch.object(DomainModel, "__init__") BarcodedSbsLabware() assert mocked_init.call_count == 1
def test_BarcodedSbsLabware_validate_barcode__raises_error_allow_null_disabled(): m = BarcodedSbsLabware() with pytest.raises(ValidationCollectionEmptyValueError): m.validate_barcode(allow_null=False)
def test_BarcodedSbsLabware_validate_barcode__raises_error_if_not_string(): m = BarcodedSbsLabware(barcode=23) with pytest.raises(ValidationCollectionCannotCoerceError): m.validate_barcode()
def test_BarcodedSbsLabware_autopopulate__fills_uuid(): m = BarcodedSbsLabware() m.autopopulate() assert m.uuid is not None
GENERIC_LABWARE_DEFINITION_KWARGS: Dict[str, Any] = { "name": "12-well", "uuid": GENERIC_UUID, "row_count": 3, "column_count": 4, "center_of_a1": (8, 7), "plate_height": 13.4, "distance_to_liquid": 4, "row_center_to_center_spacing": 12, "column_center_to_center_spacing": 15, } GENERIC_LABWARE_DEFINITION = LabwareDefinition( **GENERIC_LABWARE_DEFINITION_KWARGS) GENERIC_LABWARE_DEFINITION_2 = LabwareDefinition(name="96-well", uuid=GENERIC_UUID, row_count=3, column_count=4) GENERIC_BARCODED_SBS_LABWARE_KWARGS = { "uuid": GENERIC_UUID, "barcode": "AB9938", "labware_definition": GENERIC_LABWARE_DEFINITION_2, } GENERIC_BARCODED_SBS_LABWARE = BarcodedSbsLabware( uuid=GENERIC_UUID, barcode="AB9938", labware_definition=GENERIC_LABWARE_DEFINITION_2)
False, "different column_center_to_center_spacing", ), ( LabwareDefinition(distance_to_liquid=9), LabwareDefinition(distance_to_liquid=4.5), False, "different distance_to_liquid", ), ( GENERIC_BARCODED_SBS_LABWARE, copy.deepcopy(GENERIC_BARCODED_SBS_LABWARE), True, "same everything", ), (BarcodedSbsLabware(), "wakka", False, "different types"), ( BarcodedSbsLabware(barcode="C1234"), BarcodedSbsLabware(barcode="X999"), False, "different barcode", ), ( BarcodedSbsLabware(uuid=uuid.uuid4()), BarcodedSbsLabware(uuid=uuid.uuid4()), False, "different uuid", ), ( BarcodedSbsLabware(labware_definition=LabwareDefinition(name="bob")), BarcodedSbsLabware(labware_definition=LabwareDefinition(name="joe")),