From b5dc48503800ee1b6264e0ff84ad47058c01a13a Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 18 Aug 2021 19:24:15 +0200 Subject: convert to a code block --- pint/formatting.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pint/formatting.py b/pint/formatting.py index e9b9c3a..a04205d 100644 --- a/pint/formatting.py +++ b/pint/formatting.py @@ -139,15 +139,17 @@ def register_unit_format(name): Examples -------- - >>> @pint.register_unit_format("custom") - ... def format_custom(unit, registry, **options): - ... result = "" # do the formatting - ... return result - ... - >>> ureg = pint.UnitRegistry() - >>> u = ureg.m / ureg.s ** 2 - >>> f"{u:custom}" - '' + .. code:: python + + @pint.register_unit_format("custom") + def format_custom(unit, registry, **options): + result = "" # do the formatting + return result + + + ureg = pint.UnitRegistry() + u = ureg.m / ureg.s ** 2 + f"{u:custom}" """ def wrapper(func): -- cgit v1.2.1