예제 #1
0
    def test_asfreq_MS(self):
        initial = Period("2013")

        assert initial.asfreq(freq="M", how="S") == Period('2013-01', 'M')

        msg = pd.tseries.frequencies._INVALID_FREQ_ERROR
        with tm.assert_raises_regex(ValueError, msg):
            initial.asfreq(freq="MS", how="S")

        with tm.assert_raises_regex(ValueError, msg):
            pd.Period('2013-01', 'MS')

        assert _period_code_map.get("MS") is None
예제 #2
0
    def test_asfreq_MS(self):
        initial = Period("2013")

        assert initial.asfreq(freq="M", how="S") == Period('2013-01', 'M')

        msg = pd.tseries.frequencies._INVALID_FREQ_ERROR
        with tm.assert_raises_regex(ValueError, msg):
            initial.asfreq(freq="MS", how="S")

        with tm.assert_raises_regex(ValueError, msg):
            pd.Period('2013-01', 'MS')

        assert _period_code_map.get("MS") is None
예제 #3
0
    def test_asfreq_MS(self):
        initial = Period("2013")

        self.assertEqual(initial.asfreq(freq="M", how="S"),
                         Period('2013-01', 'M'))

        msg = pd.tseries.frequencies._INVALID_FREQ_ERROR
        with tm.assertRaisesRegexp(ValueError, msg):
            initial.asfreq(freq="MS", how="S")

        with tm.assertRaisesRegexp(ValueError, msg):
            pd.Period('2013-01', 'MS')

        self.assertTrue(_period_code_map.get("MS") is None)
예제 #4
0
    def test_asfreq_MS(self):
        initial = Period("2013")

        self.assertEqual(initial.asfreq(freq="M", how="S"),
                         Period('2013-01', 'M'))

        msg = pd.tseries.frequencies._INVALID_FREQ_ERROR
        with self.assertRaisesRegexp(ValueError, msg):
            initial.asfreq(freq="MS", how="S")

        with tm.assertRaisesRegexp(ValueError, msg):
            pd.Period('2013-01', 'MS')

        self.assertTrue(_period_code_map.get("MS") is None)