@@ -315,6 +315,18 @@ def test_price_from_pb() -> None:
315315 )
316316
317317
318+ def test_price_formatting () -> None :
319+ """Test the client price type formatting."""
320+ price = Price (amount = Decimal ("800" ), currency = Currency .JPY )
321+ assert str (price ) == "800 JPY"
322+ price = Price (amount = Decimal ("-100.3" ), currency = Currency .CHF )
323+ assert str (price ) == "-100.3 CHF"
324+ price = Price (amount = Decimal ("-103.00" ), currency = Currency .USD )
325+ assert str (price ) == "-103.00 USD"
326+ price = Price (amount = Decimal ("400.123" ), currency = Currency .EUR )
327+ assert str (price ) == "400.123 EUR"
328+
329+
318330def test_power_to_pb () -> None :
319331 """Test the client power type conversions to protobuf."""
320332 assert_conversion_to_pb (
@@ -333,6 +345,18 @@ def test_power_from_pb() -> None:
333345 )
334346
335347
348+ def test_power_formatting () -> None :
349+ """Test the client power type formatting."""
350+ power = Power (mw = Decimal ("5" ))
351+ assert str (power ) == "5 MW"
352+ power = Power (mw = Decimal ("5.1" ))
353+ assert str (power ) == "5.1 MW"
354+ power = Power (mw = Decimal ("5.100" ))
355+ assert str (power ) == "5.100 MW"
356+ power = Power (mw = Decimal ("-5.123" ))
357+ assert str (power ) == "-5.123 MW"
358+
359+
336360def test_delivery_duration_to_pb () -> None :
337361 """Test the client delivery duration type conversions to protobuf."""
338362 assert_conversion_to_pb (
0 commit comments