|
22 | 22 | import pandas as pd
|
23 | 23 | import numpy as np
|
24 | 24 | from numpy.random import randn
|
25 |
| -from pandas.compat import range, lrange, lmap, zip, text_type, PY3 |
| 25 | +from pandas.compat import range, lrange, lmap, zip, text_type, PY3, iteritems |
26 | 26 | from pandas.compat.numpy_compat import np_datetime64_compat
|
27 | 27 |
|
28 | 28 | from pandas import (Series, DataFrame,
|
|
36 | 36 | class TestPeriodProperties(tm.TestCase):
|
37 | 37 | "Test properties such as year, month, weekday, etc...."
|
38 | 38 |
|
39 |
| - # |
40 |
| - |
41 | 39 | def test_quarterly_negative_ordinals(self):
|
42 | 40 | p = Period(ordinal=-1, freq='Q-DEC')
|
43 | 41 | self.assertEqual(p.year, 1969)
|
@@ -440,6 +438,24 @@ def test_freq_str(self):
|
440 | 438 | self.assertEqual(i1.freq, offsets.Minute())
|
441 | 439 | self.assertEqual(i1.freqstr, 'T')
|
442 | 440 |
|
| 441 | + def test_period_deprecated_freq(self): |
| 442 | + cases = {"M": ["MTH", "MONTH", "MONTHLY", "Mth", "month", "monthly"], |
| 443 | + "B": ["BUS", "BUSINESS", "BUSINESSLY", "WEEKDAY", "bus"], |
| 444 | + "D": ["DAY", "DLY", "DAILY", "Day", "Dly", "Daily"], |
| 445 | + "H": ["HR", "HOUR", "HRLY", "HOURLY", "hr", "Hour", "HRly"], |
| 446 | + "T": ["minute", "MINUTE", "MINUTELY", "minutely"], |
| 447 | + "S": ["sec", "SEC", "SECOND", "SECONDLY", "second"], |
| 448 | + "L": ["MILLISECOND", "MILLISECONDLY", "millisecond"], |
| 449 | + "U": ["MICROSECOND", "MICROSECONDLY", "microsecond"], |
| 450 | + "N": ["NANOSECOND", "NANOSECONDLY", "nanosecond"]} |
| 451 | + for exp, freqs in iteritems(cases): |
| 452 | + for freq in freqs: |
| 453 | + |
| 454 | + with tm.assert_produces_warning(FutureWarning, |
| 455 | + check_stacklevel=False): |
| 456 | + res = pd.Period('2016-03-01 09:00', freq=freq) |
| 457 | + self.assertEqual(res, Period('2016-03-01 09:00', freq=exp)) |
| 458 | + |
443 | 459 | def test_repr(self):
|
444 | 460 | p = Period('Jan-2000')
|
445 | 461 | self.assertIn('2000-01', repr(p))
|
|
0 commit comments