Tests/add new test case weight_conversion (#11468)

* add new test

* add new test
This commit is contained in:
João Vitor 2024-06-26 03:06:57 -03:00 committed by GitHub
parent 75b8667187
commit 6882a8b808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -297,6 +297,12 @@ def weight_conversion(from_type: str, to_type: str, value: float) -> float:
1.660540199e-23
>>> weight_conversion("atomic-mass-unit","atomic-mass-unit",2)
1.999999998903455
>>> weight_conversion("slug", "kilogram", 1)
Traceback (most recent call last):
...
ValueError: Invalid 'from_type' or 'to_type' value: 'slug', 'kilogram'
Supported values are: kilogram, gram, milligram, metric-ton, long-ton, short-ton, \
pound, stone, ounce, carrat, atomic-mass-unit
"""
if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
msg = (