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

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

        msg = INVALID_FREQ_ERR_MSG
        with pytest.raises(ValueError, match=msg):
            initial.asfreq(freq="MS", how="S")

        with pytest.raises(ValueError, match=msg):
            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._libs.tslibs.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")

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

        msg = INVALID_FREQ_ERR_MSG
        with pytest.raises(ValueError, match=msg):
            initial.asfreq(freq="MS", how="S")

        with pytest.raises(ValueError, match=msg):
            Period('2013-01', 'MS')

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

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

        msg = pd._libs.tslibs.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