'isbn': '9780312621360' }, }, [ title_test('Flame: A Sky Chasers Novel', exact=True), authors_test(['Amy Kathleen Ryan']) ]), # Multiple authors and two part title and no general description ({ 'identifiers': { 'edelweiss': '0321180607' } }, [ title_test( "XQuery from the Experts: A Guide to the W3C XML Query Language", exact=True), authors_test([ 'Howard Katz', 'Don Chamberlin', 'Denise Draper', 'Mary Fernandez', 'Michael Kay', 'Jonathan Robie', 'Michael Rys', 'Jerome Simeon', 'Jim Tivy', 'Philip Wadler' ]), pubdate_test(2003, 8, 22), comments_test('Jérôme Siméon'), lambda mi: bool( mi.comments and 'No title summary' not in mi.comments) ]), ] start, stop = 0, len(tests) tests = tests[start:stop] test_identify_plugin(Edelweiss.name, tests)
isbn_test, title_test, authors_test, comments_test) com_tests = [ # {{{ ( # + in title and uses id="main-image" for cover {'title':'C++ Concurrency in Action'}, [title_test('C++ Concurrency in Action: Practical Multithreading', exact=True), ] ), ( # noscript description {'identifiers':{'amazon':'0756407117'}}, [title_test( "Throne of the Crescent Moon"), comments_test('Makhslood'), comments_test('Publishers Weekly'), ] ), ( # Different comments markup, using Book Description section {'identifiers':{'amazon':'0982514506'}}, [title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test('Jelena'), comments_test('Ashinji'), ] ), ( # # in title {'title':'Expert C# 2008 Business Objects', 'authors':['Lhotka']},
isbn_test, title_test, authors_test, comments_test) com_tests = [ # {{{ ( # + in title and uses id="main-image" for cover {'title':'C++ Concurrency in Action'}, [title_test('C++ Concurrency in Action: Practical Multithreading', exact=True), ] ), ( # noscript description {'identifiers':{'amazon':'0756407117'}}, [title_test( "Throne of the Crescent Moon"), comments_test('Makhslood'), comments_test('Dhamsawaat'), ] ), ( # Different comments markup, using Book Description section {'identifiers':{'amazon':'0982514506'}}, [title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test('Jelena'), comments_test('Ashinji'), ] ), ( # # in title {'title':'Expert C# 2008 Business Objects', 'authors':['Lhotka']},
from calibre.ebooks.metadata.sources.test import ( test_identify_plugin, title_test, authors_test, comments_test, pubdate_test) tests = [ ( # A title and author search {'title': 'The Husband\'s Secret', 'authors':['Liane Moriarty']}, [title_test('The Husband\'s Secret', exact=True), authors_test(['Liane Moriarty'])] ), ( # An isbn present in edelweiss {'identifiers':{'isbn': '9780312621360'}, }, [title_test('Flame: A Sky Chasers Novel', exact=True), authors_test(['Amy Kathleen Ryan'])] ), # Multiple authors and two part title and no general description ({'identifiers':{'edelweiss':'0321180607'}}, [title_test( "XQuery From the Experts: A Guide to the W3C XML Query Language" , exact=True), authors_test([ 'Howard Katz', 'Don Chamberlin', 'Denise Draper', 'Mary Fernandez', 'Michael Kay', 'Jonathan Robie', 'Michael Rys', 'Jerome Simeon', 'Jim Tivy', 'Philip Wadler']), pubdate_test(2003, 8, 22), comments_test('Jérôme Siméon'), lambda mi: bool(mi.comments and 'No title summary' not in mi.comments) ]), ] start, stop = 0, len(tests) tests = tests[start:stop] test_identify_plugin(Edelweiss.name, tests)
from calibre.ebooks.metadata.sources.test import (test_identify_plugin, isbn_test, title_test, authors_test, comments_test) com_tests = [ # {{{ ( # + in title and uses id="main-image" for cover {'title':'C++ Concurrency in Action'}, [title_test('C++ Concurrency in Action: Practical Multithreading', exact=True), ] ), ( # noscript description {'identifiers':{'amazon':'0756407117'}}, [title_test( "Throne of the Crescent Moon"), comments_test('Makhslood'), ] ), ( # Different comments markup, using Book Description section {'identifiers':{'amazon':'0982514506'}}, [title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test('Jelena'), comments_test('Ashinji'), ] ), ( # # in title {'title':'Expert C# 2008 Business Objects', 'authors':['Lhotka']},
'identifiers': { 'amazon': '1933988770' } }, [ title_test( 'C++ Concurrency in Action: Practical Multithreading', exact=True) ]), ( # noscript description { 'identifiers': { 'amazon': '0756407117' } }, [ title_test("Throne of the Crescent Moon"), comments_test('Makhslood'), comments_test('Dhamsawaat'), ]), ( # Different comments markup, using Book Description section { 'identifiers': { 'amazon': '0982514506' } }, [ title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test('Jelena'), comments_test('Ashinji'), ]), ( # # in title
log.exception('Failed to download cover from:', cached_url) # }}} if __name__ == '__main__': # tests {{{ # To run these test use: calibre-debug -e # src/calibre/ebooks/metadata/sources/amazon.py from calibre.ebooks.metadata.sources.test import (test_identify_plugin, isbn_test, title_test, authors_test, comments_test, series_test) com_tests = [ # {{{ ( # Series {'identifiers':{'amazon':'0756407117'}}, [title_test( "Throne of the Crescent Moon" , exact=True), series_test('Crescent Moon Kingdoms', 1), comments_test('Makhslood'), ] ), ( # Different comments markup, using Book Description section {'identifiers':{'amazon':'0982514506'}}, [title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy" , exact=True), comments_test('Jelena'), comments_test('Leslie'), ] ), ( # # in title {'title':'Expert C# 2008 Business Objects', 'authors':['Lhotka']},
( # + in title and uses id="main-image" for cover { 'title': 'C++ Concurrency in Action' }, [ title_test( 'C++ Concurrency in Action: Practical Multithreading', exact=True), ]), ( # noscript description { 'identifiers': { 'amazon': '0756407117' } }, [ title_test("Throne of the Crescent Moon"), comments_test('Makhslood'), ]), ( # Different comments markup, using Book Description section { 'identifiers': { 'amazon': '0982514506' } }, [ title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test('Jelena'), comments_test('Ashinji'), ]), ( # # in title {
authors_test, comments_test, ) com_tests = [ # {{{ ( # A kindle edition that does not appear in the search results when searching by ASIN {"identifiers": {"amazon": "B004JHY6OG"}}, [title_test("The Heroes: A First Law Novel", exact=True)], ), ( # + in title and uses id="main-image" for cover {"identifiers": {"amazon": "1933988770"}}, [title_test("C++ Concurrency in Action: Practical Multithreading", exact=True)], ), ( # noscript description {"identifiers": {"amazon": "0756407117"}}, [title_test("Throne of the Crescent Moon"), comments_test("Makhslood"), comments_test("Dhamsawaat")], ), ( # Different comments markup, using Book Description section {"identifiers": {"amazon": "0982514506"}}, [ title_test("Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test("Jelena"), comments_test("Ashinji"), ], ), ( # # in title {"title": "Expert C# 2008 Business Objects", "authors": ["Lhotka"]}, [title_test("Expert C# 2008 Business Objects"), authors_test(["Rockford Lhotka"])], ), ( # Description has links {"identifiers": {"isbn": "9780671578275"}},
authors_test( [ "Howard Katz", "Don Chamberlin", "Denise Draper", "Mary Fernandez", "Michael Kay", "Jonathan Robie", "Michael Rys", "Jerome Simeon", "Jim Tivy", "Philip Wadler", ] ), pubdate_test(2003, 8, 22), comments_test("Jérôme Siméon"), lambda mi: bool(mi.comments and "No title summary" not in mi.comments), ], ), ( # An isbn not present in edelweiss {"identifiers": {"isbn": "9780316044981"}, "title": "The Heroes", "authors": ["Joe Abercrombie"]}, [title_test("The Heroes", exact=True), authors_test(["Joe Abercrombie"])], ), ( # Pubdate {"title": "The Great Gatsby", "authors": ["F. Scott Fitzgerald"]}, [ title_test("The great gatsby", exact=True), authors_test(["F. Scott Fitzgerald"]), pubdate_test(2004, 9, 29), ], ),
[title_test('11/22/63: A Novel', exact=True), authors_test(['Stephen King']),] ), ( # + in title and uses id="main-image" for cover {'title':'C++ Concurrency in Action'}, [title_test('C++ Concurrency in Action: Practical Multithreading', exact=True), ] ), ( # Series {'identifiers':{'amazon':'0756407117'}}, [title_test( "Throne of the Crescent Moon", exact=True), series_test('Crescent Moon Kingdoms', 1), comments_test('Makhslood'), ] ), ( # Different comments markup, using Book Description section {'identifiers':{'amazon':'0982514506'}}, [title_test( "Griffin's Destiny: Book Three: The Griffin's Daughter Trilogy", exact=True), comments_test('Jelena'), comments_test('Leslie'), ] ), ( # # in title {'title':'Expert C# 2008 Business Objects', 'authors':['Lhotka']},