Example #1
0
    def _next_volname_to_item(self, filename):
        if self._main.flags & rarfile.RAR_MAIN_NEWNUMBERING:
            filename = rarfile._next_newvol(filename)
        else:
            filename = rarfile._next_oldvol(filename)

        return self._get_item_from_filename(filename)
Example #2
0
def test_newvols_err():
    with pytest.raises(rarfile.BadRarName):
        rarfile._next_newvol("xx.rar")
Example #3
0
def test_newvols():
    assert rarfile._next_newvol("qq00.part0.rar") == "qq00.part1.rar"
    assert rarfile._next_newvol("qq00.part09.rar") == "qq00.part10.rar"
    assert rarfile._next_newvol("qq00.part99.rar") == "qq00.part100.rar"
    assert rarfile._next_newvol("part20") == "part21.rar"
    assert rarfile._next_newvol("qq00.part3.exe") == "qq00.part4.rar"
    assert rarfile._next_newvol("qq00.part5.sfx") == "qq00.part6.rar"
    assert rarfile._next_newvol("qq00.part6.bin") == "qq00.part7.bin"
    assert rarfile._next_newvol("99") == "100.rar"
    assert rarfile._next_newvol("dir/99.rar") == "dir/100.rar"
    with pytest.raises(rarfile.BadRarName):
        rarfile._next_newvol("qq00.part7.rar/foo")
    with pytest.raises(rarfile.BadRarName):
        rarfile._next_newvol("foo")
Example #4
0
def test_newvols():
    assert rarfile._next_newvol('qq00.part0.rar') == 'qq00.part1.rar'
    assert rarfile._next_newvol('qq00.part09.rar') == 'qq00.part10.rar'
    assert rarfile._next_newvol('qq00.part99.rar') == 'qq00.paru00.rar'
Example #5
0
def test_newvols_err():
    rarfile._next_newvol('xx.rar')
Example #6
0
def test_newvols():
    eq_(rarfile._next_newvol('qq00.part0.rar'), 'qq00.part1.rar')
    eq_(rarfile._next_newvol('qq00.part09.rar'), 'qq00.part10.rar')
    eq_(rarfile._next_newvol('qq00.part99.rar'), 'qq00.paru00.rar')
Example #7
0
def test_newvols_err():
    rarfile._next_newvol('xx.rar')
Example #8
0
def test_newvols():
    eq_(rarfile._next_newvol('qq00.part0.rar'), 'qq00.part1.rar')
    eq_(rarfile._next_newvol('qq00.part09.rar'), 'qq00.part10.rar')
    eq_(rarfile._next_newvol('qq00.part99.rar'), 'qq00.paru00.rar')