def test_rename_category(): old = "Rishonim" new = "Rishon'im" assert not tm.IndexSet({"categories": new}).count() c = tm.IndexSet({"categories": old}).count() assert c t.rename_category(old, new) assert not tm.IndexSet({"categories": old}).count() assert tm.IndexSet({"categories": new}).count() t.rename_category(new, old) assert c == tm.IndexSet({"categories": old}).count()
# -*- coding: utf-8 -*- #!/usr/bin/python2.6 import sys import os import csv import sefaria.model.text as txt path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, path) sys.path.insert(0, path + "/sefaria") indexes = txt.IndexSet() with open("../tmp/text_map.csv", 'wb') as csvfile: writer = csv.writer(csvfile) writer.writerow([ "Priority", "Section", "English Title", "Hebrew Title", "Transliterated Title", "Title Variants", "Categories", "Text Structure", "Ready for Upload?", "Length", ]) for i in indexes: order = getattr(i, "order", [])