BUG: date_range linspace behavior respects tz
State: closed

- [x] closes #20983
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry (addendum to the v0.23 whatsnew entry for this feature)


Labels:
name: Bug
name: Timezones
description: Timezone data dtype

Comments:
Beat me by a few minutes!

Can you modify the test that was originally written for this behavior:

https://github.com/pandas-dev/pandas/blob/b3f07b2551b7eb40408ca28416ca5e21f8fb37b4/pandas/tests/indexes/datetimes/test_date_range.py#L165-L180

The timezone transition portion isn't being tested, as there's no `tm.assert_index_equal`.  It also looks wrong to me; `periods` is set to three, but `expected` has five elements.  I think the correct `expected` is:

```python
In [2]: pd.date_range('2018-04-01 01:00:00', '2018-04-01 04:00:00', tz='Australia/Sydney', periods=3)
Out[2]:
DatetimeIndex(['2018-04-01 01:00:00+11:00', '2018-04-01 02:00:00+10:00',
               '2018-04-01 04:00:00+10:00'],
              dtype='datetime64[ns, Australia/Sydney]', freq=None)
```
(Note that the above is evenly spaced due to the DST transition)
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20988?src=pr&el=h1) Report
> Merging [#20988](https://codecov.io/gh/pandas-dev/pandas/pull/20988?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b3f07b2551b7eb40408ca28416ca5e21f8fb37b4?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #20988      +/-   ##
==========================================
+ Coverage   91.82%   91.82%   +<.01%     
==========================================
  Files         153      153              
  Lines       49490    49489       -1     
==========================================
+ Hits        45443    45444       +1     
+ Misses       4047     4045       -2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.22% <100%> (ø)` | :arrow_up: |
| #single | `41.85% <0%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20988?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/20988/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.76% <100%> (ø)` | :arrow_up: |
| [pandas/core/window.py](https://codecov.io/gh/pandas-dev/pandas/pull/20988/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvd2luZG93LnB5) | `96.27% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/20988/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.65% <0%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/20988/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `84.59% <0%> (+0.2%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20988?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/20988?src=pr&el=footer). Last update [b3f07b2...66a9d76](https://codecov.io/gh/pandas-dev/pandas/pull/20988?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Sorry for jumping the gun @jschendel! Thanks for the review and nice catch with the missing assert.

Addressed your comment as well @jreback  
thanks @mroeschke and @jschendel