"""Test the `convert_units`""" from helpers.dimensions import UNIT_CONVERSIONS as dimension_unit_conversions from helpers.misc import convert_units def test_units_to_cm_inches(): """Test `convert_units` to cm from inches""" assert convert_units(0.5, "inches", dimension_unit_conversions) == 1.27 def test_units_to_cm_feet(): """Test `convert_units` to cm from feet""" assert convert_units(0.5, "feet", dimension_unit_conversions) == 15.24 def test_units_to_cm_cm(): """Test `convert_units` to cm from cm""" assert convert_units(0.5, "cm", dimension_unit_conversions) == 0.5 def test_units_to_cm_unrecognized(): """Test `convert_units` to cm from unrecognized unit""" assert convert_units(0.5, "yard", dimension_unit_conversions) is None