Test: rename over filtered deck

This commit is contained in:
Arthur Milchior 2019-11-13 15:49:09 +01:00
parent a4cb3debe2
commit 3d6c0ec36c

View file

@ -1,5 +1,6 @@
# coding: utf-8 # coding: utf-8
from anki.errors import DeckRenameError
from tests.shared import assertException, getEmptyCol from tests.shared import assertException, getEmptyCol
def test_basic(): def test_basic():
@ -87,6 +88,14 @@ def test_rename():
d.decks.rename(d.decks.get(id), "yo") d.decks.rename(d.decks.get(id), "yo")
for n in "yo", "yo::two", "yo::two::three": for n in "yo", "yo::two", "yo::two::three":
assert n in d.decks.allNames() assert n in d.decks.allNames()
# over filtered
parentId = d.decks.newDyn("parent")
parent = d.decks.get(parentId)
childId = d.decks.id("child")
child = d.decks.get(childId)
assertException(DeckRenameError, lambda: d.decks.rename(child, "parent::child"))
assertException(DeckRenameError, lambda: d.decks.rename(child, "PARENT::child"))
def test_renameForDragAndDrop(): def test_renameForDragAndDrop():
d = getEmptyCol() d = getEmptyCol()