Skip to content

Commit 244bfbe

Browse files
authored
Merge pull request #249 from pandas-dev/master
TST: Fix for doctest in style_render.py (pandas-dev#42778)
2 parents 3553fb1 + 01076c6 commit 244bfbe

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pandas/io/formats/style_render.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -646,21 +646,22 @@ def format(
646646
Using ``na_rep`` and ``precision`` with the default ``formatter``
647647
648648
>>> df = pd.DataFrame([[np.nan, 1.0, 'A'], [2.0, np.nan, 3.0]])
649-
>>> df.style.format(na_rep='MISS', precision=3)
649+
>>> df.style.format(na_rep='MISS', precision=3) # doctest: +SKIP
650650
0 1 2
651651
0 MISS 1.000 A
652652
1 2.000 MISS 3.000
653653
654654
Using a ``formatter`` specification on consistent column dtypes
655655
656-
>>> df.style.format('{:.2f}', na_rep='MISS', subset=[0,1])
656+
>>> df.style.format('{:.2f}', na_rep='MISS', subset=[0,1]) # doctest: +SKIP
657657
0 1 2
658658
0 MISS 1.00 A
659659
1 2.00 MISS 3.000000
660660
661661
Using the default ``formatter`` for unspecified columns
662662
663663
>>> df.style.format({0: '{:.2f}', 1: '£ {:.1f}'}, na_rep='MISS', precision=1)
664+
... # doctest: +SKIP
664665
0 1 2
665666
0 MISS £ 1.0 A
666667
1 2.00 MISS 3.0
@@ -669,7 +670,7 @@ def format(
669670
``formatter``.
670671
671672
>>> df.style.format(na_rep='MISS', precision=1, subset=[0])
672-
... .format(na_rep='PASS', precision=2, subset=[1, 2])
673+
... .format(na_rep='PASS', precision=2, subset=[1, 2]) # doctest: +SKIP
673674
0 1 2
674675
0 MISS 1.00 A
675676
1 2.0 PASS 3.00
@@ -678,6 +679,7 @@ def format(
678679
679680
>>> func = lambda s: 'STRING' if isinstance(s, str) else 'FLOAT'
680681
>>> df.style.format({0: '{:.1f}', 2: func}, precision=4, na_rep='MISS')
682+
... # doctest: +SKIP
681683
0 1 2
682684
0 MISS 1.0000 STRING
683685
1 2.0 MISS FLOAT
@@ -688,7 +690,7 @@ def format(
688690
>>> s = df.style.format(
689691
... '<a href="a.com/{0}">{0}</a>', escape="html", na_rep="NA"
690692
... )
691-
>>> s.render()
693+
>>> s.render() # doctest: +SKIP
692694
...
693695
<td .. ><a href="a.com/&lt;div&gt;&lt;/div&gt;">&lt;div&gt;&lt;/div&gt;</a></td>
694696
<td .. ><a href="a.com/&#34;A&amp;B&#34;">&#34;A&amp;B&#34;</a></td>
@@ -698,7 +700,8 @@ def format(
698700
Using a ``formatter`` with LaTeX ``escape``.
699701
700702
>>> df = pd.DataFrame([["123"], ["~ ^"], ["$%#"]])
701-
>>> s = df.style.format("\\textbf{{{}}}", escape="latex").to_latex()
703+
>>> df.style.format("\\textbf{{{}}}", escape="latex").to_latex()
704+
... # doctest: +SKIP
702705
\begin{tabular}{ll}
703706
{} & {0} \\
704707
0 & \textbf{123} \\

0 commit comments

Comments
 (0)