Prevent passing invalid kwds to DateOffset constructors
State: closed

- [ ] closes #xxxx
- [x] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Frequency
description: DateOffsets

Comments:
add a new whatsnew note indicating which classes are now strict (you did this for 0.21.0 IIRC), same language
> add a new whatsnew note indicating which classes are now strict (you did this for 0.21.0 IIRC), same language

Will do.  The 0.21.0 note didn't list subclasses.  Sure you want them listed this time?
Once we get #18224 sorted out, the assert n == int(n) will be done only once (and probably as a ValueError instead of assertion) in _BaseOffset.__init__
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=h1) Report
> Merging [#18226](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3493abaa9c47e39b410752833c901fd27f5b3a76?src=pr&el=desc) will **decrease** coverage by `0.03%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18226/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18226      +/-   ##
==========================================
- Coverage   91.42%   91.39%   -0.04%     
==========================================
  Files         163      163              
  Lines       50064    50099      +35     
==========================================
+ Hits        45773    45787      +14     
- Misses       4291     4312      +21
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.2% <100%> (-0.02%)` | :arrow_down: |
| #single | `40.38% <63.41%> (-0.04%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `97.17% <100%> (+0.06%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.38% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=footer). Last update [3493aba...1666d44](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=h1) Report
> Merging [#18226](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/be66ef832ef551d118a8e219a9e98928681df835?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18226/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18226      +/-   ##
==========================================
- Coverage   91.33%   91.32%   -0.02%     
==========================================
  Files         163      163              
  Lines       49752    49764      +12     
==========================================
+ Hits        45443    45446       +3     
- Misses       4309     4318       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.12% <100%> (ø)` | :arrow_up: |
| #single | `40.72% <79.41%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tests/tseries/offsets/conftest.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL3Rlc3RzL3RzZXJpZXMvb2Zmc2V0cy9jb25mdGVzdC5weQ==) | `97.14% <100%> (ø)` | :arrow_up: |
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `97.03% <100%> (+0.02%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=footer). Last update [be66ef8...b4b9e15](https://codecov.io/gh/pandas-dev/pandas/pull/18226?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

appveyor failure appears unrelated.  will rebase+push
#18210 looks kind of a duplicate with this. pls only have 1 per thing open at a time.
> #18210 looks kind of a duplicate with this

Removed the asserts, which should fix this perception.  They are orthogonal.
Though you're right about too many PRs.  I actually closed several last night for that reason.
> Though you're right about too many PRs. I actually closed several last night for that reason.

not a problem. just sometimes we can lose focus.
appveyor error just says 'Command exited with code 1'.  Any idea how to get something more meaningful than that?
hmm the appveyor error is in the same place as befire in test_ticks.test_Hour
Any thoughts here?  It looks vaguely like a segfault, but I don't know windows.
The segfault in appveyor is now occuring in a smoketest that just calls `Hour(3)`.  But the same construction occurs in an earlier test that doesn't seem to cause a problem.

So a new pair of eyes on this would be helpful.
I'll make the requested changes, but am way more focused on the segfault.
Now the setgfsult happens before hour test. May be related to number of tests?
Scrolling up from the error, it looks like the problem is in test collection, not the test itself.
Booyah!  Now its something unrelated in matplotlib.  Sorting the arguments going into parametrize apparently fixed it.
lgtm. ping on green.
Ping
rebase and ping on green. lgtm.
Ping
thanks @jbrockmendel