Skip to content

Backport PR #28056 on branch v3.9.x (Strip trailing spaces from log-formatter cursor output.) #28062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,11 +1177,11 @@ def test_pprint(self, value, domain, expected):
assert label == expected

@pytest.mark.parametrize('value, long, short', [
(0.0, "0", "0 "),
(0, "0", "0 "),
(-1.0, "-10^0", "-1 "),
(2e-10, "2x10^-10", "2e-10 "),
(1e10, "10^10", "1e+10 "),
(0.0, "0", "0"),
(0, "0", "0"),
(-1.0, "-10^0", "-1"),
(2e-10, "2x10^-10", "2e-10"),
(1e10, "10^10", "1e+10"),
])
def test_format_data(self, value, long, short):
fig, ax = plt.subplots()
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def format_data(self, value):

def format_data_short(self, value):
# docstring inherited
return '%-12g' % value
return ('%-12g' % value).rstrip()

def _pprint_val(self, x, d):
# If the number is not too big and it's an int, format it as an int.
Expand Down
Loading