Skip to content

Commit 4fa79f1

Browse files
committed
Add test for callable
1 parent 049e6e6 commit 4fa79f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/tests/test_sankey.py

+10
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@ def test_sankey():
1010
def test_label():
1111
s = Sankey(flows=[0.25], labels=['First'], orientations=[-1])
1212
assert s.diagrams[0].texts[0].get_text() == 'First\n0.25'
13+
14+
15+
def test_format_using_callable():
16+
# test using callable by slightly incrementing above label example
17+
18+
def show_three_decimal_places(value):
19+
return f'{value:.3f}'
20+
21+
s = Sankey(flows=[0.25], labels=['First'], orientations=[-1], format=show_three_decimal_places)
22+
assert s.diagrams[0].texts[0].get_text() == 'First\n0.250'

0 commit comments

Comments
 (0)