Пример #1
0
 def test_comicvine_volume_id_match(self):
     test_identify_plugin(Comicvine.name, [(
         {
             'title': 'Preacher',
             'identifiers': {
                 'comicvine-volume': '18059'},
         },
         [
             title_test(
                 'Preacher Special: The Story of You-Know-Who #1: '
                 'The Story of You-Know-Who',
                 exact=True
             ),
             authors_test(
                 ['Garth Ennis', 'Richard Case',
                  'Matt Hollingsworth',
                  'Clem Robins', 'Glenn Fabry',
                  'Julie Rottenberg']),
             series_test(
                 'Preacher Special: The Story of You-Know-Who',
                 1.0),
             comicvine_id_test('105747'),
             comicvine_volume_id_test('18059'),
         ]
     )])
Пример #2
0
 def test_comicvine_volume_id_match(self):
     test_identify_plugin(Comicvine.name, [({
         'title': 'Preacher',
         'identifiers': {
             'comicvine-volume': '18059'
         },
     }, [
         title_test(
             'Preacher Special: The Story of You-Know-Who #1: '
             'The Story of You-Know-Who',
             exact=True),
         authors_test([
             'Garth Ennis', 'Richard Case', 'Matt Hollingsworth',
             'Clem Robins', 'Glenn Fabry', 'Julie Rottenberg'
         ]),
         series_test('Preacher Special: The Story of You-Know-Who', 1.0),
         comicvine_id_test('105747'),
         comicvine_volume_id_test('18059'),
     ])])
Пример #3
0
            # remove all attributes from tags
            desc = re.sub(r'<([a-zA-Z0-9]+)\s[^>]+>', r'<\1>', desc)
            # Remove comments
            desc = re.sub(r'(?s)<!--.*?-->', '', desc)
            mi.comments = sanitize_comments_html(desc)

        return None


if __name__ == '__main__':
    # To run these test use:
    # calibre-debug -e src/calibre/ebooks/metadata/sources/overdrive.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test)
    test_identify_plugin(OverDrive.name,
        [

            (
                {'title':'The Sea Kings Daughter',
                    'authors':['Elizabeth Peters']},
                [title_test('The Sea Kings Daughter', exact=False),
                    authors_test(['Elizabeth Peters'])]
            ),

            (
                {'title': 'Elephants', 'authors':['Agatha']},
                [title_test('Elephants Can Remember', exact=False),
                    authors_test(['Agatha Christie'])]
            ),
    ])
Пример #4
0
                    authors=authors, timeout=timeout)

        # There is no point running these queries in threads as google
        # throttles requests returning 403 Forbidden errors
        self.get_all_details(br, log, entries, abort, result_queue, timeout)

        return None
    # }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/google.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test)
    test_identify_plugin(GoogleBooks.name,
        [


            (
                {'identifiers':{'isbn': '0743273567'}, 'title':'Great Gatsby',
                    'authors':['Fitzgerald']},
                [title_test('The great gatsby', exact=True),
                    authors_test(['F. Scott Fitzgerald'])]
            ),

            (
                {'title': 'Flatland', 'authors':['Abbott']},
                [title_test('Flatland', exact=False)]
            ),
    ])
# }}}
Пример #5
0
        log('Downloading cover from:', cached_url)
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}


if __name__ == '__main__':
    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',
Пример #6
0
            log.exception('Failed to download cover from:', cached_url)


if __name__ == '__main__': # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test, tags_test)

    test_identify_plugin(RidiBooks.name, [
        (#테라리움 어드벤처
            {
                'title':u'테라리움 어드벤처 1화'
            },
            [
                title_test(u'테라리움 어드벤처 1화'),
                authors_test([u'수하수하'])
            ]
        ),
        (
            {
                'title':u'오직 네 죽음만이 나를 1권'
            },
            [
                title_test(u'오직 네 죽음만이 나를 1권'),
                authors_test([u'플로나'])
            ]
        ),
        (# 정의란 무엇인가
            {
                'identifiers': {'ridibooks': '593000535'}
Пример #7
0
            log.error('No result found.\n', 'query: %s' % query)
            return
        self.get_all_details(gidlist=gidlist,
                             log=log,
                             abort=abort,
                             result_queue=result_queue,
                             timeout=timeout)

    # }}}


if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-customize -b ehentai_metadata && calibre-debug -e ehentai_metadata/__init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)

    test_identify_plugin(Ehentai.name,
                         [({
                             'title': 'キリト君の白くべたつくなにか',
                             'authors': ['しらたま肉球']
                         }, [title_test('キリト君の白くべたつくなにか', exact=False)]),
                          ({
                              'title': '拘束する部活動 (僕は友達が少ない)',
                              'authors': ['すもも堂 (すももEX) ', '有条色狼']
                          }, [title_test('拘束する部活動', exact=False)]),
                          ({
                              'title': '桜の蜜',
                              'authors': ['劇毒少女 (ke-ta)']
                          }, [title_test('桜の蜜', exact=False)])])
# }}}
Пример #8
0
        # There is no point running these queries in threads as douban
        # throttles requests returning 403 Forbidden errors
        self.get_all_details(br, log, entries, abort, result_queue, timeout)

        return None
    # }}}


if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/douban.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test)
    test_identify_plugin(Douban.name,
        [


            (
                {'identifiers':{'isbn': '9787536692930'}, 'title':'三体',
                    'authors':['刘慈欣']},
                [title_test('三体', exact=True),
                    authors_test(['刘慈欣'])]
            ),

            (
                {'title': 'Linux内核修炼之道', 'authors':['任桥伟']},
                [title_test('Linux内核修炼之道', exact=False)]
            ),
    ])
# }}}
Пример #9
0
            log.exception('Failed to download cover from:', cached_url)


if __name__ == '__main__': # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)

    test_identify_plugin(RidiBooks.name, [
        (# 정의란 무엇인가
            {
                'identifiers': {'ridibooks': '593000535'}
            },
            [
                title_test(u'정의란 무엇인가', exact=True),
                authors_test([u'마이클 샌델', u'김명철(역자)'])
            ]
        ),

        (# 세상에서 제일 쉬운 회계학
            {
                'title':u'회계학', 
                'authors':[u'구보 유키야']
            },
            [
                title_test(u'세상에서 가장 쉬운 회계학', exact=True),
                authors_test([u'구보 유키야', u'안혜은(역자)'])
            ]
        ),
Пример #10
0
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import (unicode_literals, division)


# Tests
# To run these test use:
# calibre-debug -e test.py

if __name__ == '__main__':
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
         title_test, authors_test)

    tests_list = [
        ({'identifiers': {'arxiv': "1412.7127v1"}},
         [title_test("Surface Operators"),
          authors_test(["Sergei Gukov"])]),

        ({'title': "The Cobordism Category and Waldhausen's K-theory",
          'authors': ['Marcel Bökstedt', 'Ib Madsen']},
         [title_test("The Cobordism Category and Waldhausen's K-theory", exact=True)]),

        ({'title': "knots fivebranes", 'authors':['Witten']},
         [title_test("Fivebranes and Knots", exact=True),
          authors_test(['Edward Witten'])]
         ),

        ({'title': "Fivebranes and knots", 'authors':['Witten']},
         [title_test("Fivebranes and Knots", exact=True),
          authors_test(['Edward Witten'])])
        ]
Пример #11
0

if __name__ == '__main__': # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)
    
    test_identify_plugin(Kyobobook.name,
        [
            # 원제 꼭지가 붙어 있다.
            # 장 코르미에 (지은이) | 김미선 (옮긴이) | 실천문학사 | 2005-05-25 | 원제 Che Guevara (2002년) 
            (# A book with an ISBN
                {'identifiers':{'isbn': '9788939205109'},
                    'title':'체 게바라', 'authors':['장 코르미에']},
                [title_test('체 게바라 평전', exact=True),
                 authors_test(['장 코르미에','김미선']),
                 series_test('역사인물찾기', 10.0)]
            ),
            
            (# A book with an kyobobook id
                {'identifiers':{'kyobobook': '9788932008486'}},
                [title_test('광장/구운몽', exact=True),
                 authors_test(['최인훈']),
                 ]
            ),
            
            (# A book with title and author
                {'identifiers':{'isbn': '9788936470111'}},
                [title_test('나의 문화유산답사기 1', exact=False),
                 authors_test(['유홍준'])]
Пример #12
0
        br = self.browser
        log('Downloading cover from:', cached_url)
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}

if __name__ == '__main__':
    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': 'Flame of Sevenwaters', 'authors':['Juliet Marillier']},
         [title_test('Flame of sevenwaters', exact=True),
                authors_test(['Juliet Marillier'])]
        ),

        (  # 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',
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test,
                                                      series_test)

    test_identify_plugin(
        Shelfari.name,
        [
            (  # A book with an ISBN
                {
                    'identifiers': {
                        'isbn': '9780385340588'
                    },
                    'title': '61 Hours',
                    'authors': ['Lee Child']
                }, [
                    title_test('61 Hours', exact=True),
                    authors_test(['Lee Child']),
                    series_test('Jack Reacher', 14.0)
                ]),
            (  # A book throwing an index error
                {
                    'title': 'The Girl Hunters',
                    'authors': ['Mickey Spillane']
                }, [
                    title_test('The Girl Hunters', exact=True),
                    authors_test(['Mickey Spillane']),
                    series_test('Mike Hammer', 7.0)
                ]),
            (  # A book with no ISBN specified
                {
                    'title': "Playing with Fire",
Пример #14
0

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 = [  # {{{
        (  # Has a spanish edition
            {
                'title': '11/22/63'
            }, [
                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'
                }
Пример #15
0
            # remove all attributes from tags
            desc = re.sub(r'<([a-zA-Z0-9]+)\s[^>]+>', r'<\1>', desc)
            # Remove comments
            desc = re.sub(r'(?s)<!--.*?-->', '', desc)
            mi.comments = sanitize_comments_html(desc)

        return None


if __name__ == '__main__':
    # To run these test use:
    # calibre-debug -e src/calibre/ebooks/metadata/sources/overdrive.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)
    test_identify_plugin(OverDrive.name, [
        ({
            'title': 'The Sea Kings Daughter',
            'authors': ['Elizabeth Peters']
        }, [
            title_test('The Sea Kings Daughter', exact=False),
            authors_test(['Elizabeth Peters'])
        ]),
        ({
            'title': 'Elephants',
            'authors': ['Agatha']
        }, [
            title_test('Elephants Can Remember', exact=False),
            authors_test(['Agatha Christie'])
        ]),
    ])
Пример #16
0
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #basic
#                 'title': 'Čarovný svět Henry Kuttnera', 'authors':['Henry Kuttner']},
#                 [title_test('Čarovný svět Henry Kuttnera', exact=False)]
#             )
#            ,
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #edice
#                 'title': 'Zlodějka knih', 'authors':['Markus Zusak']},
#                 [title_test('Zlodějka knih', exact=False)]
#             )
#            ,
             (
                 {'identifiers':{'bookfan1': '83502'}, #serie
                 'title': 'Slavné případy soudce Ti', 'authors':['Robert van Gulik']},
                 [title_test('Slavné případy soudce Ti', exact=False)]
             )
#            ,
#             (
#                 {'identifiers':{},
#                 'title': 'Meč osudu', 'authors':['Andrzej Sapkowski ']},
#                 [title_test('Meč osudu', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{},
#                 'title': 'Vysoké sázky', 'authors':['Dick Francis']},
#                 [title_test('Vysoké sázky', exact=False)]
#             )
#             ,
#             (
Пример #17
0

if __name__ == "__main__":  # tests {{{
    # To run these test use: calibre-debug 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,
    )

    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"),
Пример #18
0
            result_queue.put((self, cdata))
        except:
            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
            if mc is not None:
                mc = mc.lower()
            if mc == cover_url:
                return True
            prints('Cover test failed. Expected: \'%s\' found: ' % cover_url, mc)
            return False

        return test

    test_identify_plugin(Aladin.name,
        [

            (# A book with an ISBN
                {'identifiers':{'isbn': '9788983920683'},
                    'title':u'해리포터와 마법사의 돌', 'authors':[u'조앤.K.롤링']},
                [title_test(u'해리포터와 마법사의 돌 1', exact=True),
                 authors_test([u'조앤.K.롤링']),
                 series_test(u'해리포터', 1.0),
                 cover_test('http://image.aladin.co.kr/product/21/6/letslook/8983920688_f.jpg')]
            ),

            (# A book with no ISBN specified
                {'title':u"아투안의 무덤", 'authors':[u'어슐러 르 귄']},
                [title_test(u"아투안의 무덤", exact=True),
                 authors_test([u'어슐러 르 귄']),
                 series_test(u'어스시 전집', 2.0),
                 cover_test('http://image.aladin.co.kr/product/67/36/letslook/8982731911_f.jpg')]
            ),

            """
            (# A book with an NA cover
Пример #20
0
                name = parts.netloc or parts.path
                add(name, k, url, url)
    return ans
# }}}


if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug -e
    # src/calibre/ebooks/metadata/sources/identify.py
    from calibre.ebooks.metadata.sources.test import (test_identify,
            title_test, authors_test)
    tests = [
            (
                {'title':'Magykal Papers',
                    'authors':['Sage']},
                [title_test('Septimus Heap: The Magykal Papers', exact=True)],
            ),


            (  # An e-book ISBN not on Amazon, one of the authors is unknown to Amazon
                {'identifiers':{'isbn': '9780307459671'},
                    'title':'Invisible Gorilla', 'authors':['Christopher Chabris']},
                [title_test('The Invisible Gorilla: And Other Ways Our Intuitions Deceive Us', exact=True)]

            ),

            (  # Test absence of identifiers
                {'title':'Learning Python',
                    'authors':['Lutz']},
                [title_test('Learning Python',
                    exact=True), authors_test(['Mark J. Lutz', 'David Ascher'])
Пример #21
0
        if cached_url is None:
            log.info('No cover found')
            return

        if abort.is_set():
            return
        br = self.browser
        log('Downloading cover from:', cached_url)
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            if cdata:
                result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test)

    test_identify_plugin(Amazon_CN.name,
        [
            (
                {'identifiers':{'amazon_cn': 'B00D7YRXPG'}},
                [title_test('第七天', exact=True),
                 authors_test(['余华'])
                ]
            ),

        ])
        except:
            log.exception('Failed to download cover from:', cached_url)


if __name__ == '__main__': # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)

    test_identify_plugin(Shelfari.name,
        [
            (# A book with an ISBN
                {'identifiers':{'isbn': '9780385340588'},
                    'title':'61 Hours', 'authors':['Lee Child']},
                [title_test('61 Hours', exact=True),
                 authors_test(['Lee Child']),
                 series_test('Jack Reacher', 14.0)]
            ),

            (# A book throwing an index error
                {'title':'The Girl Hunters', 'authors':['Mickey Spillane']},
                [title_test('The Girl Hunters', exact=True),
                 authors_test(['Mickey Spillane']),
                 series_test('Mike Hammer', 7.0)]
            ),

            (# A book with no ISBN specified
                {'title':"Playing with Fire", 'authors':['Derek Landy']},
                [title_test("Playing with Fire", exact=True),
                 authors_test(['Derek Landy']),
            if mc is not None:
                mc = mc.lower()
            if mc == cover_url:
                return True
            prints("Cover test failed. Expected: '%s' found: " % cover_url, mc)
            return False

        return test

    test_identify_plugin(
        YES24.name,
        [
            (  # A book with an ISBN
                {"identifiers": {"isbn": "9788983920683"}, "title": "해리포터와 마법사의 돌", "authors": ["조앤.K.롤링"]},
                [
                    title_test("해리포터와 마법사의 돌 1", exact=True),
                    authors_test(["조앤.K.롤링"]),
                    series_test("해리포터", 1.0),
                    cover_test("http://image.yes24.com/goods/72289/L"),
                ],
            ),
            (  # A book with no ISBN specified
                {"title": "아투안의 무덤", "authors": ["어슐러 르 귄"]},
                [
                    title_test("아투안의 무덤", exact=True),
                    authors_test(["어슐러 르 귄"]),
                    series_test("어스시 전집", 2.0),
                    cover_test("http://image.yes24.com/goods/2128248/L"),
                ],
            ),
            (  # A book with a YES24 id
Пример #24
0
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug 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)
    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(
Пример #25
0
            except Exception as e:
                return e.message

        if abort.is_set():
            return "abort"

        br = self.browser
        self.log.info(u'Downloading cover from:', cached_url)
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            self.log.error(u'Failed to download cover from:', cached_url)
            return u'Failed to download cover from:%s' % cached_url  # }}}


if __name__ == '__main__':  # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)

    test_identify_plugin(GoodreadsAPI.name, [({
        u'title': u'The Omega'
        's Fake Mate',
        u'authors': [u'Ann-Katrin Byrde']
    }, [
        title_test(u'Expert C# 2008 Business Objects'),
        authors_test([u'Rockford Lhotka'])
    ])])
Пример #26
0
    # }}}


if __name__ == '__main__':
    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': {
Пример #27
0

if __name__ == '__main__': # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)
    
    test_identify_plugin(Aladin_co_kr.name,
        [
            # 원제 꼭지가 붙어 있다.
            # 장 코르미에 (지은이) | 김미선 (옮긴이) | 실천문학사 | 2005-05-25 | 원제 Che Guevara (2002년) 
            (# A book with an ISBN
                {'identifiers':{'isbn': '9788939205109'},
                    'title':'체 게바라', 'authors':['장 코르미에']},
                [title_test('체 게바라 평전', exact=True),
                 authors_test(['장 코르미에','김미선']),
                 series_test('역사 인물 찾기', 10.0)]
            ),
            
            (# A book with an aladin id
                {'identifiers':{'aladin.co.kr': '8932008485'}},
                [title_test('광장', exact=False),
                 authors_test(['최인훈']),
                 ]
            ),
            
            (# A book with title and author
                {'title':'나의 문화유산답사기 1', 'authors':['유홍준']},
                [title_test('나의 문화유산답사기 1', exact=False),
                 authors_test(['유홍준'])]
Пример #28
0
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import (unicode_literals, division)


# To run these test use:
# calibre-debug -e test.py

if __name__ == '__main__':
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
         title_test, authors_test)

    tests_list = [
        ({'identifiers': {"zbl" : "1140.18005"}},
         [title_test("Moduli of objects in dg-categories"),
          authors_test(['Bertrand Toën', 'Michel Vaquié'])]),

        ({'identifiers': {"zbl" : "0129.15601"}},
         [title_test("The stable homotopy of the classical groups"),
          authors_test(['Raoul Bott'])]),

        ({'title': "Superconnections, Thom classes", 'authors':['Mathai', 'Daniel Quillen']},
         [title_test("Superconnections, Thom classes, and equivariant differential forms"),
          authors_test(['Varghese Mathai', 'Daniel Quillen'])]),

        ({'title': "sur le nombre des points rationnels", 'authors':['serre']},
         [title_test("Sur le nombre des points rationnels d'une courbe algébrique sur un corps fini"),
          authors_test(['Jean-Pierre Serre'])]),

        ]
Пример #29
0
from __future__ import (unicode_literals, division)

# To run these test use:
# calibre-debug -e test.py

if __name__ == '__main__':
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)

    tests_list = [
        ({
            'identifiers': {
                "zbl": "1140.18005"
            }
        }, [
            title_test("Moduli of objects in dg-categories"),
            authors_test(['Bertrand Toën', 'Michel Vaquié'])
        ]),
        ({
            'identifiers': {
                "zbl": "0129.15601"
            }
        }, [
            title_test("The stable homotopy of the classical groups"),
            authors_test(['Raoul Bott'])
        ]),
        ({
            'title': "Superconnections, Thom classes",
            'authors': ['Mathai', 'Daniel Quillen']
        }, [
            title_test(
Пример #30
0
    # }}}


if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug
    # src/calibre/ebooks/metadata/sources/google.py
    from calibre.ebooks.metadata.sources.test import (
        test_identify_plugin, title_test, authors_test
    )
    tests = [({
        'identifiers': {
            'isbn': '0743273567'
        },
        'title': 'Great Gatsby',
        'authors': ['Fitzgerald']
    }, [
        title_test('The great gatsby', exact=True),
        authors_test(['F. Scott Fitzgerald'])
    ]), ({
        'title': 'Flatland',
        'authors': ['Abbott']
    }, [title_test('Flatland', exact=False)]), ({
        'title':
        'The Blood Red Indian Summer: A Berger and Mitry Mystery',
        'authors': ['David Handler'],
    }, [title_test('The Blood Red Indian Summer: A Berger and Mitry Mystery')])]
    test_identify_plugin(GoogleBooks.name, tests[:])

# }}}
                                                      series_test)

    test_identify_plugin(
        Kyobobook.name,
        [
            # 원제 꼭지가 붙어 있다.
            # 장 코르미에 (지은이) | 김미선 (옮긴이) | 실천문학사 | 2005-05-25 | 원제 Che Guevara (2002년)
            (  # A book with an ISBN
                {
                    'identifiers': {
                        'isbn': '9788939205109'
                    },
                    'title': '체 게바라',
                    'authors': ['장 코르미에']
                }, [
                    title_test('체 게바라 평전', exact=True),
                    authors_test(['장 코르미에', '김미선']),
                    series_test('역사인물찾기', 10.0)
                ]),
            (  # A book with an kyobobook id
                {
                    'identifiers': {
                        'kyobobook': '9788932008486'
                    }
                }, [
                    title_test('광장/구운몽', exact=True),
                    authors_test(['최인훈']),
                ]),
            (  # A book with title and author
                {
                    'identifiers': {
Пример #32
0
			mc = mi.cover_url
			if mc is not None:
				mc = mc.lower()
			if mc == cover_url:
				return True
			prints('Cover test failed. Expected: \'%s\' found: ' % cover_url, mc)
			return False
		return test

	# Test the plugin.
	test_identify_plugin(ISFDB.name,
		[
			(# A book with an ISBN
				{'identifiers':{'isbn': '9780345470638'},
					'title':'Black House', 'authors':['Stephen King', 'Peter Straub']},
				[title_test('Black House', exact=True),
				 authors_test(['Stephen King', 'Peter Straub']),
				 cover_test('http://images.amazon.com/images/P/034547063X.01.LZZZZZZZ.jpg')]
			),

			(# A book with no ISBN specified
				{'title':'Black House', 'authors':['Stephen King', 'Peter Straub']},
				[title_test('Black House', exact=True),
				 authors_test(['Stephen King', 'Peter Straub']),
				 cover_test('http://images.amazon.com/images/P/034547063X.01.LZZZZZZZ.jpg')]
			),

			(# A book with an ISFDB ID
				{'identifiers':{'isfdb': '4638'},
					'title':'Black House', 'authors':['Stephen King', 'Peter Straub']},
				[title_test('Black House', exact=True),
Пример #33
0
        if desc:
            desc = desc[0]
            desc = html.tostring(desc, method="html", encoding=unicode).strip()
            # remove all attributes from tags
            desc = re.sub(r"<([a-zA-Z0-9]+)\s[^>]+>", r"<\1>", desc)
            # Remove comments
            desc = re.sub(r"(?s)<!--.*?-->", "", desc)
            mi.comments = sanitize_comments_html(desc)

        return None


if __name__ == "__main__":
    # To run these test use:
    # calibre-debug -e src/calibre/ebooks/metadata/sources/overdrive.py
    from calibre.ebooks.metadata.sources.test import test_identify_plugin, title_test, authors_test

    test_identify_plugin(
        OverDrive.name,
        [
            (
                {"title": "The Sea Kings Daughter", "authors": ["Elizabeth Peters"]},
                [title_test("The Sea Kings Daughter", exact=False), authors_test(["Elizabeth Peters"])],
            ),
            (
                {"title": "Elephants", "authors": ["Agatha"]},
                [title_test("Elephants Can Remember", exact=False), authors_test(["Agatha Christie"])],
            ),
        ],
    )
Пример #34
0
                break
        return isbn


if __name__ == "__main__":  # tests {{{
    # To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/douban.py
    from calibre.ebooks.metadata.sources.test import (
        test_identify_plugin,
        title_test,
        authors_test,
    )

    test_identify_plugin(
        Douban.name,
        [
            (
                {
                    "identifiers": {
                        "isbn": "9787536692930",
                        "douban": 2567698
                    },
                    "title": "三体",
                    "authors": ["刘慈欣"],
                },
                [title_test("三体", exact=True),
                 authors_test(["刘慈欣"])],
            ),
        ],
    )
# }}}
Пример #35
0
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import (unicode_literals, division)


# Tests
# To run these test use:
# calibre-debug -e test.py

if __name__ == '__main__':
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
         title_test, authors_test)

    tests_list = [
        ({'identifiers': {"mr" : "1053945"}},
         [title_test(u"Decomposition theorem for proper Kähler morphisms"),
          authors_test(['Morihiko Saito'])]),

        ({'title': "Arithmetic and Geometry", 'authors':['Artin']},
         [title_test("Arithmetic And Geometry. Vol"),
          authors_test(['Michael Artin', 'John Tate'])]),

        ({'title': "Superconnections, Thom classes", 'authors':['Mathai', 'Daniel Quillen']},
         [title_test("Superconnections, Thom classes, and equivariant differential forms"),
          authors_test(['Varghese Mathai', 'Daniel Quillen'])]),

        ({'title': "sur le nombre des points rationnels", 'authors':['serre']},
         [title_test("Sur le nombre des points rationnels d'une courbe algébrique sur un corps fini"),
          authors_test(['Jean-Pierre Serre'])])
        ]
Пример #36
0
        '''
        def keygen(data):
            return PreFilterMetadataCompare(data, self, title, authors)
        return keygen

if __name__ == '__main__': # tests
    # To run these test setup calibre library (that inner which contains  calibre-debug)
    # and run run.bat
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)
    test_identify_plugin(Dbknih.name,
        [                                            
             (
                 {'identifiers':{'bookfan1': '83502'}, #basic, edice
                 'title': 'Čarovný svět Henry Kuttnera', 'authors':['Henry Kuttner']},
                 [title_test('Čarovný svět Henry Kuttnera', exact=False)]
             )
#            ,
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #server tags
#                 'title': 'Zlodějka knih', 'authors':['Markus Zusak']},
#                 [title_test('Zlodějka knih', exact=False)]
#             )
#            ,
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #serie
#                 'title': 'Hra o trůny', 'authors':['George Raymond Richard Martin']},
#                 [title_test('Hra o trůny', exact=False)]
#             )
#            ,
#             (
Пример #37
0
if __name__ == '__main__':  # tests
    # To run these test use:
    # calibre-customize -b . ; calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)

    tests = [
        (  # A book with an ISBN
            {
                'identifiers': {
                    'isbn': '9788740065756'
                },
                'title': 'Casper',
                'authors': ['Martin Kongstad']
            }, [
                title_test('Casper', exact=True),
                authors_test(['Martin Kongstad'])
            ]),
        (  # A book with two Authors
            {
                'identifiers': {
                    'isbn': '9788771761306'
                },
                'title': 'Elverfolket- Ulverytterne og solfolket',
                'authors': ['Richard Pini & Wendy']
            }, [
                title_test('Elverfolket- Ulverytterne og solfolket',
                           exact=True),
                authors_test(['Richard Pini', 'Wendy'])
            ])
    ]
Пример #38
0

# }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug -e
    # src/calibre/ebooks/metadata/sources/identify.py
    from calibre.ebooks.metadata.sources.test import (test_identify,
                                                      title_test, authors_test)
    tests = [
        (
            {
                'title': 'Magykal Papers',
                'authors': ['Sage']
            },
            [title_test('Septimus Heap: The Magykal Papers', exact=True)],
        ),
        (  # An e-book ISBN not on Amazon, one of the authors is unknown to Amazon
            {
                'identifiers': {
                    'isbn': '9780307459671'
                },
                'title': 'Invisible Gorilla',
                'authors': ['Christopher Chabris']
            }, [
                title_test(
                    'The Invisible Gorilla: And Other Ways Our Intuitions Deceive Us',
                    exact=True)
            ]),
        (  # Test absence of identifiers
            {
Пример #39
0
#             )
#            ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Meč osudu', 'authors':['Andrzej Sapkowski']},
#                 [title_test('Meč osudu', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Růže pro Algernon', 'authors':['Daniel Keyes']},
#                 [title_test('Růže pro Algernon', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Vlk', 'authors':['Eric Eliot Knight']},
#                 [title_test('Vlk', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Lovci kostí', 'authors':['Steven Erikson']},
#                 [title_test('Lovci kostí', exact=False)]
#             )
            (
                {'identifiers':{}, #short story
                'title': 'Ve službách klanu', 'authors':['Miroslav Žamboch']},
                [title_test('Ve službách klanu', exact=False)]
            )
        ])
Пример #40
0
    test_identify_plugin(
        Ozon.name,
        [
            #            (
            #                {'identifiers':{}, 'title':u'Норвежский язык: Практический курс',
            #                    'authors':[u'Колесников В.П.', u'Г.В. Шатков']},
            #                [title_test(u'Норвежский язык: Практический курс', exact=True),
            #                 authors_test([u'В. П. Колесников', u'Г. В. Шатков'])]
            #            ),
            ({
                'identifiers': {
                    'isbn': '9785916572629'
                }
            }, [
                title_test(u'На все четыре стороны', exact=True),
                authors_test([u'А. А. Гилл'])
            ]),
            ({
                'identifiers': {},
                'title': u'Der Himmel Kennt Keine Gunstlinge',
                'authors': [u'Erich Maria Remarque']
            }, [
                title_test(u'Der Himmel Kennt Keine Gunstlinge', exact=True),
                authors_test([u'Erich Maria Remarque'])
            ]),
            ({
                'identifiers': {},
                'title': u'Метро 2033',
                'authors': [u'Дмитрий Глуховский']
            }, [title_test(u'Метро 2033', exact=False)]),
Пример #41
0
#            ,
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #edice
#                 'title': 'Zlodějka knih', 'authors':['Markus Zusak']},
#                 [title_test('Zlodějka knih', exact=False)]
#             )
#            ,
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #serie
#                 'title': 'Hra o trůny', 'authors':['George Raymond Richard Martin']},
#                 [title_test('Hra o trůny', exact=False)]
#             )
#            ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Meč osudu', 'authors':['Andrzej Sapkowski ']},
#                 [title_test('Meč osudu', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Vlk', 'authors':['Eric Eliot Knight']},
#                 [title_test('Vlk', exact=False)]
#             )
#             ,
            (
                {'identifiers':{}, #redirect
                'title': 'Děti Duny', 'authors':['Frank Patrick Herbert']},
                [title_test('Děti Duny', exact=False)]
            )
        ])
Пример #42
0
        based on title and authors
        '''
        def keygen(data):
            return PreFilterMetadataCompare(data, self, title, authors)
        return keygen

if __name__ == '__main__': # tests
    # To run these test setup calibre library (that inner which contains  calibre-debug)
    # and run run.bat
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)
    test_identify_plugin(Baila.name,
        [
#             (
#                 {'identifiers':{'test-case':'long search'},
#                  'title': 'Vlk', 'authors':['E. E Knight']},
#                 [title_test('Vlk', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{'test-case':'redirect search'},
#                  'title': 'Bestie uvnitř', 'authors':['Soren Hammer','Lotte Hammerová']},
#                 [title_test('Bestie uvnitř', exact=False)]
#             )
#             ,
            (
                {'identifiers':{'test-case':'simple book'},
                 'title': 'Duna', 'authors':['Frank Herbert']},
                [title_test('Duna', exact=False)]
            )
        ])
Пример #43
0
    # }}}


if __name__ == "__main__":  # tests {{{
    # To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/douban.py
    from calibre.ebooks.metadata.sources.test import (
        test_identify_plugin,
        title_test,
        authors_test,
    )

    test_identify_plugin(
        Douban.name,
        [
            (
                {
                    "identifiers": {"isbn": "9787536692930"},
                    "title": "三体",
                    "authors": ["刘慈欣"],
                },
                [title_test("三体", exact=True), authors_test(["刘慈欣"])],
            ),
            (
                {"title": "Linux内核修炼之道", "authors": ["任桥伟"]},
                [title_test("Linux内核修炼之道", exact=False)],
            ),
        ],
    )
# }}}
Пример #44
0
if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug 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 = [  # {{{
        (  # Paperback with series
            {
                'identifiers': {
                    'amazon': '1423146786'
                }
            }, [
                title_test(
                    'The Heroes of Olympus, Book Five The Blood of Olympus',
                    exact=True),
                series_test('Heroes of Olympus', 5)
            ]),
        (  # Kindle edition with series
            {
                'identifiers': {
                    'amazon': 'B0085UEQDO'
                }
            }, [
                title_test('Three Parts Dead', exact=True),
                series_test('Craft Sequence', 1)
            ]),
        (  # A kindle edition that does not appear in the search results when searching by ASIN
            {
                'identifiers': {
Пример #45
0
            return None

        if abort.is_set():
            return
        br = self.browser
        log('Downloading cover from:', cached_url)
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.info("Could not download Cover")


if __name__ == '__main__':  # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test,
                                                      series_test)

    test_identify_plugin(DNB_DE.name, [
        ({
            'identifiers': {
                'isbn': '9783404285266'
            }
        }, [
            title_test('Sehnsucht des Herzens', exact=True),
            authors_test(['Lucas, Joanne St.'])
        ]),
    ])
Пример #46
0
    # To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/ozon.py
    # comment some touched_fields before run thoses tests
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, isbn_test)

    test_identify_plugin(Ozon.name,
        [
#            (
#                {'identifiers':{}, 'title':u'Норвежский язык: Практический курс',
#                    'authors':[u'Колесников В.П.', u'Г.В. Шатков']},
#                [title_test(u'Норвежский язык: Практический курс', exact=True),
#                 authors_test([u'В. П. Колесников', u'Г. В. Шатков'])]
#            ),
             (
                {'identifiers':{'isbn': '9785916572629'}},
                [title_test(u'На все четыре стороны', exact=True),
                 authors_test([u'А. А. Гилл'])]
             ),
             (
                {'identifiers':{}, 'title':u'Der Himmel Kennt Keine Gunstlinge',
                    'authors':[u'Erich Maria Remarque']},
                [title_test(u'Der Himmel Kennt Keine Gunstlinge', exact=True),
                 authors_test([u'Erich Maria Remarque'])]
             ),
             (
                {'identifiers':{}, 'title':u'Метро 2033',
                    'authors':[u'Дмитрий Глуховский']},
                [title_test(u'Метро 2033', exact=False)]
             ),
             (
                {'identifiers':{'isbn': '9785170727209'}, 'title':u'Метро 2033',
Пример #47
0
        return tags


if __name__ == '__main__':  # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)

    test_identify_plugin(
        Knygoslt.name,
        [
            (  # Knyga pagal viršelį
                {
                    'title': u'Helenos paslaptis'
                }, [title_test(u'Helenos paslaptis', exact=True)]),
        ])
    '''
            (# Knyga pagal viršelį
                {'identifiers':{'isbn': '9955101296'}},
                [title_test(u'Skaitmeninės sąmonės', exact=True)]
            ),
            (# Knyga pagal viršelį
                {'title':u'Tėvas Gorijo'},
                [title_test(u'Tėvas Gorijo', exact=True)]
            ),
            (# Knyga pagal viršelį
                {'title':'Helenos paslaptis'},
                [title_test('Helenos paslaptis', exact=True),
                 authors_test(['Lucinda Riley'])]
            ),
Пример #48
0
    # }}}


if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug
    # src/calibre/ebooks/metadata/sources/google.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)
    tests = [({
        'identifiers': {
            'isbn': '0743273567'
        },
        'title': 'Great Gatsby',
        'authors': ['Fitzgerald']
    }, [
        title_test('The great gatsby', exact=True),
        authors_test(['F. Scott Fitzgerald'])
    ]),
             ({
                 'title': 'Flatland',
                 'authors': ['Abbott']
             }, [title_test('Flatland', exact=False)]),
             ({
                 'title':
                 'The Blood Red Indian Summer: A Berger and Mitry Mystery',
                 'authors': ['David Handler'],
             }, [
                 title_test(
                     'The Blood Red Indian Summer: A Berger and Mitry Mystery')
             ])]
    test_identify_plugin(GoogleBooks.name, tests[:])
Пример #49
0
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug 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)
    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'),
                ]
            ),
Пример #50
0
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)


if __name__ == '__main__': # tests
    # To run these test use:
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
            title_test, authors_test, series_test)
    test_identify_plugin(Legie.name,
        [
         
            ( # A book with no id specified
                {'title':"Poslední obyvatel z planety Zwor", 'authors':['Jean-pierre Garen']},
                [title_test("Poslední obyvatel z planety Zwor",
                    exact=True), authors_test(['Jean-pierre Garen']),
                    series_test('Mark Stone - Kapitán Služby pro dohled nad primitivními planetami', 1.0)]

            ),

            ( # Multiple answers
                {'title':'Čaroprávnost'},
                [title_test('Čaroprávnost',
                    exact=True), authors_test(['Terry Pratchett']),
                    series_test('Úžasná Zeměplocha', 3.0)]

            ),

            ( # Book with given id and edition year
                {'identifiers':{'legie': '103#1996'},'title':'Čaroprávnost'},
                [title_test('Čaroprávnost',
Пример #51
0
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug 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)
    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'),
                ]
            ),
Пример #52
0
        try:
            cdata = br.open_novisit(cached_url, timeout=timeout).read()
            result_queue.put((self, cdata))
        except:
            log.exception('Failed to download cover from:', cached_url)
    # }}}

if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug 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)
    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(
Пример #53
0
'''
calibre_plugins.comicvine - A calibre metadata source for comicvine
'''
from calibre_plugins.comicvine.source import Comicvine

if __name__ == '__main__':
  from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                    title_test, authors_test,
                                                    series_test)
  test_identify_plugin(Comicvine.name, [
      (
        {
          'title': 'Preacher Special: The Story of You-Know-Who',
          'authors': 'Garth Ennis' 
          },
        [
          title_test('Preacher Special: The Story of You-Know-Who', 
                     exact=False),
          authors_test(['Garth Ennis', 'Richard Case', 'Matt Hollingsworth',
                        'Clem Robins', 'Glenn Fabry', 'Julie Rottenberg']),
         ]
      ), 
    ]
)
Пример #54
0
        # throttles requests returning 403 Forbidden errors
        self.get_all_details(br, log, entries, abort, result_queue, timeout)

        return None

    # }}}


if __name__ == '__main__':  # tests {{{
    # To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/douban.py
    from calibre.ebooks.metadata.sources.test import (
        test_identify_plugin, title_test, authors_test
    )
    test_identify_plugin(
        Douban.name, [
            ({
                'identifiers': {
                    'isbn': '9787536692930'
                },
                'title': '三体',
                'authors': ['刘慈欣']
            }, [title_test('三体', exact=True),
                authors_test(['刘慈欣'])]),
            ({
                'title': 'Linux内核修炼之道',
                'authors': ['任桥伟']
            }, [title_test('Linux内核修炼之道', exact=False)]),
        ]
    )
# }}}
Пример #55
0
        if self.tags:
            try:
                meta_data.tags = self.tags
            except:
                self.log.exception('Error loading tags')

        # Put meta data
        self.plugin.clean_downloaded_metadata(meta_data)
        self.result_queue.put(meta_data)


if __name__ == '__main__':  # tests
    # To run these test use:
    # calibre-customize -b . ; calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)

    tests = [(  # A book with two Authors
        {
            'identifiers': {
                'isbn': '9788763847902'
            },
            'title': 'Den faldne djævel',
            'authors': ['Kenneth Bøgh Andersen']
        }, [
            title_test('Den faldne djævel', exact=True),
            authors_test(['Kenneth Bøgh Andersen'])
        ])]

    test_identify_plugin(Mofibo.name, tests)