8000 ENH: EngFormatter new kwarg 'sep' by afvincent · Pull Request #6542 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ENH: EngFormatter new kwarg 'sep' #6542

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
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5a550f2
ENH: Add the space_sep option to EngFormatter, and docstring updates
afvincent Jun 6, 2016
722f5d6
FIX: force format_eng(-0.0) to be consistent with format_eng(0)
afvincent Jun 6, 2016
3c221ff
Fix docstrings and comments (remove leading spaces)
afvincent Jun 7, 2016
122cfa2
Simplify and move cleaning strip op. from 'format_eng' to '__call__'
afvincent Jun 7, 2016
07f022d
DOC: update the api example engineering_formatter.py
afvincent Jun 19, 2016
e371e5a
More extensive testing of EngFormatter (including 'space_sep' param)
afvincent Feb 11, 2017
3049a2d
space_sep=bool <- sep=string, and adapt tests
afvincent Feb 12, 2017
e0a2ec8
remove unnecessary trailing 'u' characters in strings
afvincent Feb 12, 2017
1621a2d
fix EngFormatter docstring: escape Unicode character codes
afvincent Feb 12, 2017
c82dcff
'fix' docstring: unindent and reorder bullet list + mention regular t…
afvincent Feb 12, 2017
f09a1b4
Update the example
afvincent Feb 12, 2017
dc9409b
fix test docstring PEP8 errors in test_ticker.py
afvincent Feb 12, 2017
0195beb
Add a 'whats_new' entry
afvincent Feb 12, 2017
3ec1dbd
docstring overhaul: fix bull 8000 et list and merge duplicated infos betwee…
afvincent Feb 13, 2017
cd2ac88
use named entities instead of raw unicode codes
afvincent Aug 17, 2017
7f1422c
stop mixing C-style and format-based formatting
afvincent Aug 17, 2017
aba7a7f
Small example tweaking to avoid label cluttering
afvincent Aug 17, 2017
b75f20d
fix an issue with {:g} and str format
afvincent Aug 17, 2017
41a69da
get rid of decimal.Decimal + fix rounding special cases like 999.9...
afvincent Aug 19, 2017
556ec20
Fix the related rounding discrepancies in test_ticker
afvincent Aug 19, 2017
a9af431
(try) fix(ing) an exception about raising an int to a negative power
afvincent Aug 19, 2017
0bde03a
fix some anntzer's comments
afvincent Aug 20, 2017
c98ba91
more complete handling of corner-case roundings + add proper tests
afvincent Aug 20, 2017
60b95ab
Fix some additional remarks made by anntzer
afvincent Aug 21, 2017
ac42b94
Deprecate passing a string as *num* argument
afvincent Aug 24, 2017
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
Prev Previous commit
Next Next commit
fix test docstring PEP8 errors in test_ticker.py
  • Loading branch information
afvincent committed Aug 25, 2017
commit dc9409b6a96a313376bc96a3005a0f5463f9f872
11 changes: 5 additions & 6 deletions lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,10 @@ def test_params(self, input, expected):
"""
Test the formatting of EngFormatter for various values of the 'places'
argument, in several cases:
0. without unit but with a space separator;
1. with both a unit and a space separator;
2. with a unit but no space separator;
3. with neihter a unit nor a space separator.
0. without a unit symbol but with a (default) space separator;
1. with both a unit symbol and a (default) space separator;
2x. with both a unit symbol and some non default separators;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this 'x'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using it to indicate that both cases 2. and 3. were looped over several subcases ("2a", "2b", etc. in my head…). But the meaning is not obvious, so I will just switch for "2." and "3."

3x. without a unit symbol but with some non default separators.
"""

UNIT = 's' # seconds
Expand Down Expand Up @@ -611,13 +611,12 @@ def test_params(self, input, expected):

# Test several non default separators: no separator, a narrow
# no-break space (unicode character) and an extravagant string.
for _sep in ("","\u202f", "@_@"):
for _sep in ("", "\u202f", "@_@"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\N{THIN SPACE} here too? (not a big deal)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ec92520

# Case 2x: unit=UNIT and sep=_sep.
# Remove the space separator from the reference case.
exp_outputs = (_s + _sep + UNIT if _s[-1] in DIGITS # no prefix
else _s.replace(" ", _sep) + UNIT
for _s in expected)
#exp_outputs = list(_s.replace(" ", _sep) + UNIT for _s in expected)
formatters = (
mticker.EngFormatter(unit=UNIT, sep=_sep), # places=None
mticker.EngFormatter(unit=UNIT, places=0, sep=_sep),
Expand Down
0