From e888319c9f41c77332b8135ae88bdae622701cfa Mon Sep 17 00:00:00 2001 From: Simon Thomas Date: Wed, 25 Sep 2024 17:54:33 +0100 Subject: [PATCH] fix doctests --- sithom/unc.py | 10 +++++----- sithom/xr.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sithom/unc.py b/sithom/unc.py index f3e832a..e6e3869 100644 --- a/sithom/unc.py +++ b/sithom/unc.py @@ -32,18 +32,18 @@ def tex_uf( >>> from sithom.unc import tex_uf >>> uf = ufloat(1, 0.5) >>> tex_uf(uf, bracket=True, force_latex=True) - '$\\left( 1.0 \\pm 0.5 \\right)$' + '$\\\\left( 1.0 \\\\pm 0.5 \\\\right)$' >>> uf = ufloat(10, 5) >>> tex_uf(uf, bracket=True, force_latex=True) - '$\\left( \\left(1.0 \\pm 0.5\\right) \\times 10^{1} \\right)$' + '$\\\\left( \\\\left(1.0 \\\\pm 0.5\\\\right) \\\\times 10^{1} \\\\right)$' >>> tex_uf(ufloat(0.0, 0.0), bracket=True, force_latex=True) # works weirdly - '$\\left( 0.0 \\pm 0 \\right)$' + '$\\\\left( 0.0 \\\\pm 0 \\\\right)$' >>> tex_uf(ufloat(2, 0.06), bracket=True, force_latex=True) - '$\\left( 2.0 \\pm 0.1 \\right)$' + '$\\\\left( 2.0 \\\\pm 0.1 \\\\right)$' (Had to add twice as many backslashes for pytest to run.) - TODO: Fix connsistency to get bullet points right. + TODO: Fix consistency to get bullet points right. """ # trying to deal with divide by zero possibility. if ufloat_input.n == 0.0: diff --git a/sithom/xr.py b/sithom/xr.py index f52aaba..54fd4b6 100644 --- a/sithom/xr.py +++ b/sithom/xr.py @@ -95,7 +95,7 @@ def _latexify(units: str) -> str: >>> _latexify("kg m s**-2") 'kg m s$^{-2}$' >>> _latexify("degree_Celsius") - '$^{\\circ}$C' + '$^{\\\\circ}$C' >>> _latexify("degK") 'K'