Example #1
0
def test_creation(unit):
    """Verify that a Concentration Type instantiates with the properproperty values from inputs."""
    value = random.randint(0, 1000) / 10
    instance = ConcentrationType(value, unit)
    assert isinstance(instance, ConcentrationType)
    assert instance.value == value
    assert instance.as_(unit) == pytest.approx(value)
Example #2
0
def test_conversion(inVal, inUnit, outVal, outUnit):
    """Verify appropriate conversions between types."""
    instance = ConcentrationType(inVal, inUnit)
    result = instance.as_(outUnit)
    assert result == pytest.approx(outVal)