def test_unit_errors(attr, unit): ''' - currently salinity only has psu in there since there is no conversion from psu to ppt, though ppt is a valid unit. This needs to be fixed - similarly, sediment only has mg/l as units. We need to decide if we want more units here ''' w = Water() w.wave_height = 1 w.fetch = 10000 with pytest.raises(InvalidUnitError): w.get(attr, unit) with pytest.raises(InvalidUnitError): w.set(attr, 5, unit)
def test_Water_set(attr, unit): w = Water() w.set(attr, 1.0, unit) assert getattr(w, attr) == 1.0 assert w.units[attr] == unit
def test_exceptions(attr, unit): w = Water() with pytest.raises(InvalidUnitError): w.get(attr, unit) with pytest.raises(InvalidUnitError): w.set(attr, 5, unit)
def test_exceptions(attr, unit): w = Water() with pytest.raises(InvalidUnitError): w.get(attr, unit) with pytest.raises(InvalidUnitError): w.set(attr, 5, unit)
def test_unit_errors(attr, unit): ''' - currently salinity only has psu in there since there is no conversion from psu to ppt, though ppt is a valid unit. This needs to be fixed - similarly, sediment only has mg/l as units. We need to decide if we want more units here ''' w = Water() with pytest.raises(InvalidUnitError): w.get(attr, unit) with pytest.raises(InvalidUnitError): w.set(attr, 5, unit)
def test_Water_set(attr, unit): w = Water() w.set(attr, 1.0, unit) assert getattr(w, attr) == 1.0 assert w.units[attr] == unit