示例#1
0
                    '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)
示例#2
0
            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']},
示例#3
0
            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']},
示例#4
0
    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)
示例#5
0
    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)
示例#6
0
文件: amazon.py 项目: 089git/calibre
    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']},
示例#7
0
         '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
示例#8
0
            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']},
示例#9
0
 (  # + 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
     {
示例#10
0
        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"}},
示例#11
0
         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),
     ],
 ),
示例#12
0
             [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']},