コード例 #1
0
ファイル: test_settings.py プロジェクト: Anodarai/PartSeg
 def test_clean_redo(self, tmp_path):
     settings = BaseSettings(tmp_path)
     for i in range(10):
         settings.add_history_element(i)
     for _ in range(5):
         settings.history_pop()
     settings.history_current_element()
     settings.history_redo_clean()
     settings.history_current_element()
コード例 #2
0
ファイル: test_settings.py プロジェクト: Anodarai/PartSeg
    def test_modifying_history(self, tmp_path):
        settings = BaseSettings(tmp_path)
        for i in range(10):
            settings.add_history_element(i)

        assert settings.history_size() == 10
        assert settings.history_redo_size() == 0

        with pytest.raises(IndexError):
            settings.history_next_element()

        for i in range(9, 5, -1):
            assert settings.history_current_element() == i
            assert settings.history_pop() == i

        assert settings.history_current_element() == 5
        assert settings.history_size() == 6
        assert settings.history_redo_size() == 4
        settings.add_history_element(7)
        assert settings.history_size() == 7
        assert settings.history_redo_size() == 0