def test_line_marc_to_book(self): with open(os.path.join(EXAMPLES_PATH, 'line_marc.txt')) as line_marc: book = MARC.line_to_book(line_marc.read()) expected_title = "Wege aus einer kranken Gesellschaft" self.assertEqual( book.title, expected_title, "Expected title %s, got title %s" % (expected_title, book.title))
def test_line_marc_to_book(self): with open(os.path.join(EXAMPLES_PATH, 'line_marc.txt')) as line_marc: book = MARC.line_to_book(line_marc.read()) expected_title = "Wege aus einer kranken Gesellschaft" self.assertEquals(book.title, expected_title, "Expected title %s, got title %s" % (expected_title, book.title))
def test_unicode_line_marc_to_book(self): line_marc_file = example_path('line_marc_unicode.txt') with open(line_marc_file) as line_marc: book = MARC.line_to_book(line_marc.read()) expected_author = u'ƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒƓƔƕƖƘƙƚƛƜƝƞƟƠơ' expected_title = u'ΛΦϞЌЍЖ⁁⅀∰ ﬢﬡ-中英字典こんにちはß' self.assertEquals(book.primary_author.name, expected_author, "Expected author %s, got author %s" % \ (expected_author, book.primary_author.name)) self.assertEquals(book.primary_author.name, expected_author, "Expected title %s, got title %s" % \ (expected_title, book.title))