예제 #1
0
def test_upgrade():
    import tempfile, shutil
    src = os.path.join(testDir, "support", "anki12.anki")
    (fd, dst) = tempfile.mkstemp(suffix=".anki")
    print "upgrade to", dst
    shutil.copy(src, dst)
    deck = Deck(dst)
    # creation time should have been adjusted
    d = datetime.datetime.fromtimestamp(deck.crt)
    assert d.hour == 4 and d.minute == 0
    # 3 new, 2 failed, 1 due
    assert deck.sched.counts() == (3,2,1)
    # now's a good time to test the integrity check too
    deck.fixIntegrity()
예제 #2
0
파일: test_deck.py 프로젝트: ChYi/libanki
def test_upgrade():
    import tempfile, shutil
    src = os.path.join(testDir, "support", "anki12.anki")
    (fd, dst) = tempfile.mkstemp(suffix=".anki")
    print "upgrade to", dst
    shutil.copy(src, dst)
    deck = Deck(dst)
    # creation time should have been adjusted
    d = datetime.datetime.fromtimestamp(deck.crt)
    assert d.hour == 4 and d.minute == 0
    # 3 new, 2 failed, 1 due
    assert deck.sched.counts() == (3, 2, 1)
    # now's a good time to test the integrity check too
    deck.fixIntegrity()