Skip to content

Commit 24926a3

Browse files
ShiryuRebsedatguzelsemme
authored andcommitted
Tests/add new test case weight_conversion (TheAlgorithms#11468)
* add new test * add new test
1 parent 97cfbfd commit 24926a3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

conversions/weight_conversion.py

+6
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ def weight_conversion(from_type: str, to_type: str, value: float) -> float:
297297
1.660540199e-23
298298
>>> weight_conversion("atomic-mass-unit","atomic-mass-unit",2)
299299
1.999999998903455
300+
>>> weight_conversion("slug", "kilogram", 1)
301+
Traceback (most recent call last):
302+
...
303+
ValueError: Invalid 'from_type' or 'to_type' value: 'slug', 'kilogram'
304+
Supported values are: kilogram, gram, milligram, metric-ton, long-ton, short-ton, \
305+
pound, stone, ounce, carrat, atomic-mass-unit
300306
"""
301307
if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
302308
msg = (

0 commit comments

Comments
 (0)