TST: tests for GH4862, GH7401, GH7403, GH7405
closes https://github.com/pydata/pandas/issues/4862
closes https://github.com/pydata/pandas/issues/7401
closes https://github.com/pydata/pandas/issues/7403
closes https://github.com/pydata/pandas/issues/7405

minor code change to https://github.com/pydata/pandas/pull/9061; otherwise only tests. the code change is to avoid https://github.com/pydata/pandas/issues/9170 issue.
