test_is_full.py 570 B

1234567891011121314151617181920212223
  1. import pytest
  2. from pandas import PeriodIndex
  3. def test_is_full():
  4. index = PeriodIndex([2005, 2007, 2009], freq="A")
  5. assert not index.is_full
  6. index = PeriodIndex([2005, 2006, 2007], freq="A")
  7. assert index.is_full
  8. index = PeriodIndex([2005, 2005, 2007], freq="A")
  9. assert not index.is_full
  10. index = PeriodIndex([2005, 2005, 2006], freq="A")
  11. assert index.is_full
  12. index = PeriodIndex([2006, 2005, 2005], freq="A")
  13. with pytest.raises(ValueError, match="Index is not monotonic"):
  14. index.is_full
  15. assert index[:0].is_full