-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Make color validation more forgiving #29122
Conversation
Can you add a test for this? I'm not super familiar with this code but the intent of the ValueError getting raises also doesn't seem to match what you are asking for here, so test would help clarify that |
I know that in theory it is best for the person submitting a PR to write tests, but I have almost no familiarity with the code base, so it would take me much longer than someone who knows the code, and I am more likely to break something. |
But I can clarify the test case. This example:
Should be legal because the style is specifying a shape, not a color. Instead it raises "Cannot pass 'style' string with a color symbol and 'color' keyword argument. The line of code I'm changing checks whether the style string contains any letters |
You can look at the tests defined in pandas/tests/plotting. Both test_series.py and test_frame.py should have examples you can copy; the color validation tests may be the best |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above if you could add tests would be great
a6d6d89
to
00b7b88
Compare
Whoops, I've done something horribly wrong to your branch @AllenDowney. Will fix it up. |
Ahh, I see. This was against 0.25.x. All our PRs go through master first. |
thank you!
…On Tue, Nov 5, 2019, at 1:24 PM, Tom Augspurger wrote:
***@***.**** approved this pull request.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#29122?email_source=notifications&email_token=AAOLP3MAOEMKLLHZRBR3G6LQSG27JA5CNFSM4JCWT4T2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKL6JAQ#pullrequestreview-311944322>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAOLP3JRCRT6Z3VB6TLS3C3QSG27JANCNFSM4JCWT4TQ>.
|
Thanks Allen! |
…ndexing-1row-df * upstream/master: (109 commits) stronger typing in libreduction (pandas-dev#29502) API: rename labels to codes (pandas-dev#29509) CLN: remove unnecessary type checks (pandas-dev#29517) implement _BaseGrouper (pandas-dev#29520) CLN: F-string formatting in pandas/_libs/*.pyx (pandas-dev#29527) Fixed more SS03 errors (pandas-dev#29540) consolidate dim checks (pandas-dev#29536) REF: separate out _get_cython_func_and_vals (pandas-dev#29537) remove unnecessary exception (pandas-dev#29538) TST:Add test to check single category col returns series with single row slice (pandas-dev#29521) Make color validation more forgiving (pandas-dev#29122) DOC: update bottleneck repo and documentation urls (pandas-dev#29516) TST: add test for df construction from dict with tuples (pandas-dev#29497) add test for pd.melt dtypes preservation (pandas-dev#29510) updated DataFrame.equals docstring (pandas-dev#29496) Resolved merge conflicts (pandas-dev#29506) DOC: Improved pandas/compact/__init__.py (pandas-dev#29507) DOC: Update performance comparison section of io docs (pandas-dev#28890) TST: add test for df.where() with category dtype (pandas-dev#29454) DOC: Fix docs on merging categoricals. (pandas-dev#28185) ...
The following test is wrong!
The color of a single Line2D cannot usually be a list. Perhaps a list of the 3 RGB or the 4 RGBa values. But not |
The current version throws a false positive if the style string contains
s
oro
, which are valid marker styles and not colors. For example:should be legal, but currently throws an error.
My suggestion is to check for only the letters that are color codes.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff