def xtest_subject_order(self): gen = compile_marc_spec("650:a--x--v--y--z") data = [ ( [("a", "Authors, American"), ("y", "19th century"), ("x", "Biography.")], "Authors, American -- 19th century -- Biography.", ), ([("a", "Western stories"), ("x", "History and criticism.")], "Western stories -- History and criticism."), ( [("a", "United States"), ("x", "History"), ("y", "Revolution, 1775-1783"), ("x", "Influence.")], "United States -- History -- Revolution, 1775-1783 -- Influence.", ), ( [("a", "West Indies, British"), ("x", "History"), ("y", "18th century.")], "West Indies, British -- History -- 18th century.", ), ( [("a", "Great Britain"), ("x", "Relations"), ("z", "West Indies, British.")], "Great Britain -- Relations -- West Indies, British.", ), ( [("a", "West Indies, British"), ("x", "Relations"), ("z", "Great Britain.")], "West Indies, British -- Relations -- Great Britain.", ), ] for (input, expect) in data: output = [i for i in gen(MockRecord(input))] self.assertEqual([expect], output)
def test_by_statement(self): gen = compile_marc_spec("245:c") data = [ ( [ ("a", u"Trois contes de No\u0308el"), ("c", u"[par] Madame Georges Renard,"), ("c", u"edited by F. Th. Meylan ..."), ], "[par] Madame Georges Renard, edited by F. Th. Meylan ...", ) ] for (input, expect) in data: output = [i for i in gen(MockRecord(input))] self.assertEqual([expect], output)
def test_title(self): gen = compile_marc_spec("245:ab clean_name") data = [ ( [ ("a", "Railroad construction."), ( "b", "Theory and practice. A textbook for the use of students in colleges and technical schools.", ), ("b", "By Walter Loring Webb."), ], "Railroad construction. Theory and practice. A textbook for the use of students in colleges and technical schools. By Walter Loring Webb.", ) ] for (input, expect) in data: output = [i for i in gen(MockRecord(input))] self.assertEqual([expect], output)