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'),
         ]
     )])
Example #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'),
     ])])
Example #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'])]
            ),
    ])
Example #4
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.'])
        ]),
    ])
Example #5
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']),
         ]
      ), 
    ]
)
Example #6
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': {
                'edelweiss': '0321180607'
Example #7
0
    # 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'])
            ])
    ]
            br = self.browser
            _raw = br.open_novisit(search_url, timeout=timeout)
            raw = _raw.read()
        except Exception as e:
            log.exception('Failed to make identify query: %s' % search_url)
            return as_unicode(e)

        candidate_bokelai_id_list = self.parse_bokelai_query_page(log, raw)
        if not candidate_bokelai_id_list:
            log.error('No result found.\n', 'query: %s' % search_url)
            return

        for bid in candidate_bokelai_id_list:
            if abort.is_set:
                pass
            self.retrieve_bokelai_detail(bid, log, result_queue, timeout)


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(Bokelai.name, [({
        'identifiers': {
            'isbn': '9789862376836'
        },
        'title': '姊嫁物語 01',
        'authors': ['森薰']
    }, [title_test('姊嫁物語 01', exact=False),
        authors_test(['森薰'])])])
# }}}
Example #9
0
            ),

            (  # 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', exact=True),
                    authors_test(['Rockford Lhotka'])
                    ]
            ),

            (  # Description has links
                {'identifiers':{'isbn': '9780671578275'}},
                [title_test('A Civil Campaign: A Comedy of Biology and Manners',
                    exact=True), authors_test(['Lois McMaster Bujold'])
                 ]

            ),

            (  # Sophisticated comment formatting
                {'identifiers':{'isbn': '9781416580829'}},
                [title_test('Angels & Demons - Movie Tie-In: A Novel',
                    exact=True), authors_test(['Dan Brown'])]
Example #10
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)
Example #11
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)]),
        ({
Example #12
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(Goodreads.name,
        [
            ( # 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':"Harry Potter and the Sorcerer's Stone", 'authors':['J.K. Rowling']},
                [title_test("Harry Potter and the Sorcerer's Stone", exact=True),
                 authors_test(['J. K. Rowling']),
                 series_test('Harry Potter', 1.0)]

            ),

            ( # A book with an ISBN
                {'identifiers':{'isbn': '9780385340588'},
                    'title':'61 Hours', 'authors':['Lee Child']},
                [title_test('61 Hours', exact=True),
Example #13
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(
        CBDB.name,
        [
            (  # 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': "Harry Potter and the Sorcerer's Stone",
                    'authors': ['J.K. Rowling']
                }, [
                    title_test("Harry Potter and the Sorcerer's Stone",
                               exact=True),
                    authors_test(['J. K. Rowling']),
                    series_test('Harry Potter', 1.0)
                ]),
            (  # A book with an ISBN
                {
                    'identifiers': {
    # calibre-debug -e __init__.py
    from calibre.ebooks.metadata.sources.test import test_identify_plugin, title_test, authors_test, series_test

    test_identify_plugin(
        BeamEbooks.name,
        [
            (
                # A Perry Rhodan book with a beam ebooks id, old naming convention
                {
                    "identifiers": {"beam-ebooks": "12748"},
                    "title": "Invasion aus dem All",
                    "authors": ["Clark Darlton"],
                },
                [
                    title_test("PR0007 - Invasion aus dem All", exact=True),
                    authors_test(["Clark Darlton"]),
                    series_test("Perry Rhodan, Die dritte Macht", 7.0),
                ],
            ),
            (
                # A Perry Rhodan book with a beam ebooks id, new naming convention
                {
                    "identifiers": {"beam-ebooks": "19938"},
                    "title": "PERRY RHODAN-Heftroman 2601: Galaxis in Aufruhr",
                    "authors": ["Leo Lukas"],
                },
                [
                    title_test("PR2601 - Galaxis in Aufruhr", exact=True),
                    authors_test(["Leo Lukas"]),
                    series_test("Perry Rhodan, Neuroversum", 2601.0),
                ],
Example #15
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("На все четыре стороны", exact=True), authors_test(["А. А. Гилл"])],
            ),
            (
                {"identifiers": {}, "title": "Der Himmel Kennt Keine Gunstlinge", "authors": ["Erich Maria Remarque"]},
                [title_test("Der Himmel Kennt Keine Gunstlinge", exact=True), authors_test(["Erich Maria Remarque"])],
            ),
            (
                {"identifiers": {}, "title": "Метро 2033", "authors": ["Дмитрий Глуховский"]},
                [title_test("Метро 2033", exact=False)],
            ),
            (
                {"identifiers": {"isbn": "9785170727209"}, "title": "Метро 2033", "authors": ["Дмитрий Глуховский"]},
                [
                    title_test("Метро 2033", exact=True),
                    authors_test(["Дмитрий Глуховский"]),
                    isbn_test("9785170727209"),
Example #16
0
            self.clean_downloaded_metadata(result)
            result_queue.put(result)


if __name__ == '__main__':
    # Tests
    # calibre-customize -b . && calibre-debug -e __init__.py

    from calibre.ebooks.metadata.sources.test import (test_identify_plugin, title_test, authors_test)

    test_identify_plugin(BookradarMetadataSourcePlugin.name, [
        (
            {'identifiers': {'isbn': '9785932861578'}},
            [
                title_test(u'Python. Подробный справочник', exact=True),
                authors_test([u'Дэвид Бизли'])
            ]
        ),
        (
            {
                'title': u'справочник',
                'identifiers': {'isbn': '9785932861578'}
            },
            [
                title_test(u'Python. Подробный справочник', exact=True),
                authors_test([u'Дэвид Бизли'])
            ]
        ),
        (
            {
                'title': u'Opencv Computer Vision',
Example #17
0
			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),
				 authors_test(['Stephen King', 'Peter Straub']),
            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']),
                 series_test('Skulduggery Pleasant', 2.0)]
Example #19
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)]
            ),
    ])
# }}}
Example #20
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(
        WorldCatxISBN.name,
        [
            (  # A book with an ISBN
                {
                    'identifiers': {
                        'isbn': '9780380789016'
                    }
                }, [
                    title_test('Neverwhere', exact=True),
                    authors_test(['Neil Gaiman'])
                ]),
            (  # A book with two authors
                {
                    'identifiers': {
                        'isbn': '0765325950'
                    }
                }, [
                    title_test('A memory of light', exact=True),
                    authors_test(['Robert Jordan', 'Brandon Sanderson'])
                ]),
        ])
    #TODO: test for errors when no ISBN is supplied?
Example #21
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, 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'}
            },
Example #22
0
            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 -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'}},
                [title_test(
                "Throne of the Crescent Moon",
                exact=True), series_test('Crescent Moon Kingdoms', 1),
                comments_test('Makhslood'),
Example #23
0
        # 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(['Francis Scott Fitzgerald'])]
            ),

            (
                {'title': 'Flatland', 'authors':['Abbott']},
                [title_test('Flatland', exact=False)]
            ),
    ])
# }}}

Example #24
0
        pubdate_test,
    )

    tests = [
        # 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),
            ],
        ),
        (  # 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"])],
        ),
Example #25
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)]
            ),
    ])
# }}}
                                                      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']
Example #27
0
                                                  title_test, authors_test,
                                                  comments_test,
                                                  pubdate_test)
tests = [
    # 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)
    ]),
    (  # An isbn not present in edelweiss
        {
            'identifiers': {
                'isbn': '9780316044981'
            },
            'title': 'The Heroes',
            'authors': ['Joe Abercrombie']
        }, [
            title_test('The Heroes', exact=True),
Example #28
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(['유홍준'])]
            ), # 9788936470111
Example #29
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)],
            ),
        ],
    )
# }}}
Example #30
0
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'])])
        ]
Example #31
0
            ),

            (  # 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'}},
                [title_test('A Civil Campaign: A Comedy of Biology and Manners',
                    exact=True), authors_test(['Lois McMaster Bujold'])
                 ]

            ),

            (  # Sophisticated comment formatting
                {'identifiers':{'isbn': '9781416580829'}},
                [title_test('Angels & Demons - Movie Tie-In: A Novel',
                    exact=True), authors_test(['Dan Brown'])]

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'안혜은(역자)'])
            ]
        ),

        (# 테메레르 6권
Example #33
0
#   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'])]),

        ]
Example #34
0
 ),
 (  # 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"}},
     [
         title_test("A Civil Campaign: A Comedy of Biology and Manners", exact=True),
         authors_test(["Lois McMaster Bujold"]),
     ],
 ),
 (  # Sophisticated comment formatting
     {"identifiers": {"isbn": "9781416580829"}},
     [title_test("Angels & Demons - Movie Tie-In: A Novel", exact=True), authors_test(["Dan Brown"])],
 ),
 (  # No specific problems
     {"identifiers": {"isbn": "0743273567"}},
     [title_test("The great gatsby", exact=True), authors_test(["F. Scott Fitzgerald"])],
Example #35
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'])
        ]),
    ])
                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
                {'identifiers':{'isbn':'9780451063953'},
Example #37
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(["刘慈欣"])],
            ),
        ],
    )
# }}}
Example #38
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(['余华'])
                ]
            ),

        ])
Example #39
0
             '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'])
     ]),
 (  # Sophisticated comment formatting
     {
         'identifiers': {
             'isbn': '9781416580829'
         }
     }, [
         title_test('Angels & Demons', exact=True),
         authors_test(['Dan Brown'])
     ]),
 (  # A newer book
     {
         'identifiers': {
             'isbn': '9780316044981'
         }
                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
                {"identifiers": {"yes24": "6185205"}, "title": "칼의 노래", "authors": ["김훈"]},
Example #41
0
                [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'])
                 ]

            ),

            (  # Sophisticated comment formatting
                {'identifiers':{'isbn': '9781416580829'}},
                [title_test('Angels & Demons',
                    exact=True), authors_test(['Dan Brown'])]
            ),

            (  # A newer book
                {'identifiers':{'isbn': '9780316044981'}},
                [title_test('The Heroes', exact=True),
                    authors_test(['Joe Abercrombie'])]
Example #42
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'])
    ])])
Example #43
0
             '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'
         }
     }, [
         title_test('A Civil Campaign: A Comedy of Biology and Manners',
                    exact=True),
         authors_test(['Lois McMaster Bujold'])
     ]),
 (  # Sophisticated comment formatting
     {
         'identifiers': {
             'isbn': '9781416580829'
Example #44
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(['유홍준'])]
            ),
Example #45
0
    # 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',
                    'authors':[u'Дмитрий Глуховский']},
Example #46
0
# 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"
Example #47
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__':
    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',
    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'
Example #49
0
        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',
Example #50
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"])],
            ),
        ],
    )
Example #51
0
            ),

            (  # 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'}},
                [title_test('A Civil Campaign: A Comedy of Biology and Manners',
                    exact=True), authors_test(['Lois McMaster Bujold'])
                 ]

            ),

            (  # Sophisticated comment formatting
                {'identifiers':{'isbn': '9781416580829'}},
                [title_test('Angels & Demons - Movie Tie-In: A Novel',
                    exact=True), authors_test(['Dan Brown'])]
Example #52
0
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'])])
        ]

    test_identify_plugin("Mathscinet", tests_list)
Example #53
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)]),
        ]
    )
# }}}
Example #54
0
            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 = [
        # 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)
        ]),

        (  # 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),