Skip to content

Commit 6ea7dc7

Browse files
authored
Merge pull request #10052 from QuLogic/unit-tests
Use consistent float-to-str formatting for tests with units
2 parents af185be + 14d4808 commit 6ea7dc7

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
@@ -631,8 +631,8 @@ def test_polar_units():
631631
units.register()
632632

633633
pi = np.pi
634-
deg = units.UnitDbl(1.0, "deg")
635-
km = units.UnitDbl(1.0, "km")
634+
deg = units.deg
635+
km = units.km
636636

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

0 commit comments

Comments
 (0)