8000 Backport PR #10052: Use consistent float-to-str formatting for tests … · matplotlib/matplotlib@b72f8fc · GitHub
[go: up one dir, main page]

Skip to content

Commit b72f8fc

Browse files
anntzerMeeseeksDev[bot]
authored andcommitted
Backport PR #10052: Use consistent float-to-str formatting for tests with units
1 parent 8e7ffec commit b72f8fc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/matplotlib/testing/jpl_units/UnitDblFormatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ def __call__( self, x, pos = None ):
3636
if len(self.locs) == 0:
3737
return ''
3838
else:
39-
return str(x)
39+
return '{:.12}'.format(x)
4040

4141
def format_data_short( self, value ):
4242
"Return the value formatted in 'short' format."
43-
return str(value)
43+
return '{:.12}'.format(value)
4444

4545
def format_data( self, value ):
4646
"Return the value formatted into a string."
47-
return str(value)
47+
return '{:.12}'.format(value)

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ def test_polar_units():
589589
units.register()
590590

591591
pi = np.pi
592-
deg = units.UnitDbl(1.0, "deg")
593-
km = units.UnitDbl(1.0, "km")
592+
deg = units.deg
593+
km = units.km
594594

595595
x1 = [pi/6.0, pi/4.0, pi/3.0, pi/2.0]
596596
x2 = [30.0*deg, 45.0*deg, 60.0*deg, 90.0*deg]

0 commit comments

Comments
 (0)
0