def test_nonplural_lead_units_works(da_lead, lead_units): """Test that non-plural lead units work on lead units check.""" da_lead["lead"].attrs["units"] = lead_units[:-1] with pytest.warns(UserWarning) as record: has_valid_lead_units(da_lead) expected = f'The letter "s" was appended to the lead units; now {lead_units}.' assert record[0].message.args[0] == expected
def test_valid_lead_units_invalid_units(da_lead): """Test that valid lead units check breaks if invalid units provided.""" da_lead["lead"].attrs["units"] = "dummy" with pytest.raises(AttributeError): has_valid_lead_units(da_lead)
def test_valid_lead_units(da_lead, lead_units): """Test that lead units check passes with appropriate lead units.""" da_lead["lead"].attrs["units"] = lead_units assert has_valid_lead_units(da_lead)
def test_valid_lead_units_no_units(da_lead): """Test that valid lead units check breaks if there are no units.""" with pytest.raises(AttributeError): has_valid_lead_units(da_lead)
def test_valid_lead_units_invalid_units(da_lead): """Test that valid lead units check breaks if invalid units provided.""" da_lead['lead'].attrs['units'] = 'dummy' with pytest.raises(AttributeError): has_valid_lead_units(da_lead)