mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Tests/add new test case weight_conversion (#11468)
* add new test * add new test
This commit is contained in:
parent
75b8667187
commit
6882a8b808
|
@ -297,6 +297,12 @@ def weight_conversion(from_type: str, to_type: str, value: float) -> float:
|
||||||
1.660540199e-23
|
1.660540199e-23
|
||||||
>>> weight_conversion("atomic-mass-unit","atomic-mass-unit",2)
|
>>> weight_conversion("atomic-mass-unit","atomic-mass-unit",2)
|
||||||
1.999999998903455
|
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:
|
if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
|
||||||
msg = (
|
msg = (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user