|
11 | 11 |
|
12 | 12 | import datetime
|
13 | 13 |
|
| 14 | +import pytz |
| 15 | + |
14 | 16 | import numpy as np
|
15 | 17 | from numpy import ma
|
16 | 18 | from numpy import arange
|
@@ -4335,6 +4337,55 @@ def test_pandas_indexing_hist():
|
4335 | 4337 | fig, axes = plt.subplots()
|
4336 | 4338 | axes.hist(ser_2)
|
4337 | 4339 |
|
| 4340 | +@image_comparison(baseline_images=['date_timezone_x'], extensions=['png']) |
| 4341 | +def test_date_timezone_x(): |
| 4342 | + # Tests issue 5575 |
| 4343 | + time_index = [pytz.timezone('Canada/Eastern').localize(datetime.datetime( |
| 4344 | + year=2016, month=2, day=22, hour=x)) for x in range(3)] |
| 4345 | + |
| 4346 | + # Same Timezone |
| 4347 | + fig = plt.figure(figsize=(20, 12)) |
| 4348 | + plt.subplot(2, 1, 1) |
| 4349 | + plt.plot_date(time_index, [3] * 3, tz='Canada/Eastern') |
| 4350 | + |
| 4351 | + # Different Timezone |
| 4352 | + plt.subplot(2, 1, 2) |
| 4353 | + plt.plot_date(time_index, [3] * 3, tz='UTC') |
| 4354 | + |
| 4355 | + |
| 4356 | +@image_comparison(baseline_images=['date_timezone_y'], |
| 4357 | + extensions=['png']) |
| 4358 | +def test_date_timezone_y(): |
| 4359 | + # Tests issue 5575 |
| 4360 | + time_index = [pytz.timezone('Canada/Eastern').localize(datetime.datetime( |
| 4361 | + year=2016, month=2, day=22, hour=x)) for x in range(3)] |
| 4362 | + |
| 4363 | + # Same Timezone |
| 4364 | + fig = plt.figure(figsize=(20, 12)) |
| 4365 | + plt.subplot(2, 1, 1) |
| 4366 | + plt.plot_date([3] * 3, |
| 4367 | + time_index, tz='Canada/Eastern', xdate=False, ydate=True) |
| 4368 | + |
| 4369 | + # Different Timezone |
| 4370 | + plt.subplot(2, 1, 2) |
| 4371 | + plt.plot_date([3] * 3, time_index, tz='UTC', xdate=False, ydate=True) |
| 4372 | + |
| 4373 | + |
| 4374 | +@image_comparison(baseline_images=['date_timezone_x_and_y'], |
| 4375 | + extensions=['png']) |
| 4376 | +def test_date_timezone_x_and_y(): |
| 4377 | + # Tests issue 5575 |
| 4378 | + time_index = [pytz.timezone('UTC').localize(datetime.datetime( |
| 4379 | + year=2016, month=2, day=22, hour=x)) for x in range(3)] |
| 4380 | + |
| 4381 | + # Same Timezone |
| 4382 | + fig = plt.figure(figsize=(20, 12)) |
| 4383 | + plt.subplot(2, 1, 1) |
| 4384 | + plt.plot_date(time_index, time_index, tz='UTC', ydate=True) |
| 4385 | + |
| 4386 | + # Different Timezone |
| 4387 | + plt.subplot(2, 1, 2) |
| 4388 | + plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True) |
4338 | 4389 |
|
4339 | 4390 | if __name__ == '__main__':
|
4340 | 4391 | import nose
|
|
0 commit comments