예제 #1
0
 def do_test(domain, start=0, stop=None):
     tests = globals().get(domain+'_tests')
     if stop is None:
         stop = len(tests)
     tests = tests[start:stop]
     test_identify_plugin(Amazon.name, tests, modify_plugin=lambda
             p:(setattr(p, 'testing_domain', domain), setattr(p, 'touched_fields', p.touched_fields - {'tags'})))
예제 #2
0
 def do_test(domain, start=0, stop=None):
     tests = globals().get(domain+'_tests')
     if stop is None:
         stop = len(tests)
     tests = tests[start:stop]
     test_identify_plugin(Amazon.name, tests, modify_plugin=lambda
             p:setattr(p, 'testing_domain', domain))
예제 #3
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'),
         ]
     )])
예제 #4
0
    def test_list(self):
        f = open("test/failing_titles.txt")
        lines = f.readlines()
        f.close()

        lines = [line.replace("\n", "") for line in lines]
        lines = [line.split('|') for line in lines]

        tuples = [({'title': line[1]}, [comicvine_id_test(line[0])])
                  for line in lines]

        test_identify_plugin(Comicvine.name, tuples)
예제 #5
0
 def do_test(domain, start=0, stop=None):
     tests = globals().get(domain + "_tests")
     if stop is None:
         stop = len(tests)
     tests = tests[start:stop]
     test_identify_plugin(
         Amazon.name,
         tests,
         modify_plugin=lambda p: (
             setattr(p, "testing_domain", domain),
             setattr(p, "touched_fields", p.touched_fields - {"tags"}),
         ),
     )
예제 #6
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)],
            ),
        ],
    )
# }}}
예제 #7
0
파일: google.py 프로젝트: yesplease/calibre
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[:])

# }}}
예제 #8
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)]),
        ({
            'identifiers': {
                'isbn': '9785170727209'
            },
            'title': u'Метро 2033',
            'authors': [u'Дмитрий Глуховский']
        }, [
            title_test(u'Метро 2033', exact=True),
            authors_test([u'Дмитрий Глуховский']),
            isbn_test('9785170727209')
        ]),
        ({
            'identifiers': {
                'isbn': '5-699-13613-4'
            },
            'title': u'Метро 2033',
            'authors': [u'Дмитрий Глуховский']
        }, [
            title_test(u'Метро 2033', exact=True),
            authors_test([u'Дмитрий Глуховский'])
        ]),
        ({
            'identifiers': {},
            'title': u'Метро',
            'authors': [u'Глуховский']
        }, [title_test(u'Метро', exact=False)]),
    ])
예제 #9
0
            total, found, results = self.parse_feed(feed, seen, title, authors,
                                                    identifiers)
            total_found += found
            candidates += results
            if total_found >= total or len(candidates) > 9:
                break

        return candidates

    # }}}


if __name__ == '__main__':
    # To run these test use:
    # calibre-debug -e src/calibre/ebooks/metadata/sources/isbndb.py
    from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
                                                      title_test, authors_test)
    test_identify_plugin(ISBNDB.name, [
        ({
            '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)]),
    ])
예제 #10
0
    test_identify_plugin(Cbdb.name,
        [
#             (
#                 {'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': '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)]
            )
        ])
예제 #11
0
파일: douban.py 프로젝트: MarioJC/calibre
        # 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)]
            ),
    ])
# }}}
예제 #12
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?
예제 #13
0
    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',
            'authors': u'Howse'
        }, [
            title_test(u'Opencv Computer Vision with Python', exact=True),
            authors_test([u'Joseph Howse'])
        ]),
    ])
예제 #14
0
파일: ozon.py 프로젝트: AtulKumar2/calibre
    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'Дмитрий Глуховский']},
                [title_test(u'Метро 2033', exact=True),
                    authors_test([u'Дмитрий Глуховский']),
                    isbn_test('9785170727209')]
             ),
             (
                {'identifiers':{'isbn': '5-699-13613-4'}, 'title':u'Метро 2033',
                    'authors':[u'Дмитрий Глуховский']},
                [title_test(u'Метро 2033', exact=True),
                 authors_test([u'Дмитрий Глуховский'])]
             ),
             (
                {'identifiers':{}, 'title':u'Метро',
                    'authors':[u'Глуховский']},
                [title_test(u'Метро', exact=False)]
             ),
    ])
예제 #15
0
		    if cached_url is not None:
			break

	if cached_url is None:
	    log.info('No cover found')
	    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.'])]
	),
    ])
예제 #16
0
    test_identify_plugin(Cbdb.name,
        [
#             (
#                 {'identifiers':{'bookfan1': '83502'}, #redirect to book without search page
#                 'title': 'Čarovný svět Henry Kuttnera', 'authors':['Henry Kuttner']},
#                 [title_test('Čarovný svět Henry Kuttnera', exact=False)]
#             )
#            ,
#             (
#                 {'identifiers':{}, #more covers
#                 'title': 'Duna', 'authors':['Frank Herbert']},
#                 [title_test('Duna', 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': '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': 'Dilvermoon', 'authors':['Raymon Huebert Aldridge']},
#                 [title_test('Dilvermoon', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Vlk', 'authors':['Eric Eliot Knight']},
#                 [title_test('Vlk', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #more covers
#                 'title': 'Duna', 'authors':['Frank Herbert']},
#                 [title_test('Duna', exact=False)]
#             )
#             ,
             (
                 {'identifiers':{'cbdb': '22750'},
                 'title': 'Dějiny židovského národa', 'authors':['Paul Johnson']},
                 [title_test('Dějiny židovského národa', exact=False)]
             )
        ])
예제 #17
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)
예제 #18
0
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': {
                    '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 with a CBDB id
            {
                'identifiers': {
                    'cbdb': '6977769'
                },
                'title': '61 Hours',
                'authors': ['Lee Child']
            }, [
                title_test('61 Hours', exact=True),
                authors_test(['Lee Child']),
                series_test('Jack Reacher', 14.0)
            ]),
    ])
            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(['森薰'])])])
# }}}
예제 #20
0
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권
            {
                'title': u"테메레르 큰바다뱀",
            }, [
                title_test(u"테메레르 6권 - 큰바다뱀들의 땅", exact=True),
                authors_test([u'나오미 노빅', u'공보경(역자)']),
                series_test('테메레르', 6.0)
            ]),
        (  # 나홀로 여행 컨설팅북
            {
                'title': u"나홀로 여행 컨설팅북",
            }, [
                title_test(u"나홀로 여행 컨설팅북", exact=True),
                authors_test([u'이주영']),
            ])
    ],
    fail_missing_meta=False)
예제 #21
0
    test_identify_plugin(
        noosfere.name,
        [
            (  # A book with ISBN specified not in noosfere
                {
                    'identifiers': {
                        'isbn': '9782265070769'
                    },
                    'title': 'Le chenal noir',
                    'authors': ['G.-J. Arnaud']
                }, [
                    title_test("Le Chenal noir", exact=True),
                    authors_test(['G.-J. Arnaud']),
                    series_test('La Compagnie des glaces - Nouvelle époque', 2)
                ]),
            (  # A book with ISBN specified 
                {
                    'identifiers': {
                        'isbn': '2-266-03441-3'
                    },
                    'title': 'Futurs sans escale',
                    'authors': ['ANTHOLOGIE']
                }, [
                    title_test("Futurs sans escale", exact=True),
                    authors_test(['ANTHOLOGIE']),
                    series_test('Isaac Asimov présente', 1)
                ]),
            (  # A book with ISBN specified
                {
                    'identifiers': {
                        'isbn': '2-265-04038-X'
                    },
                    'title': 'Onze bonzes de bronze',
                    'authors': ['Max ANTHONY']
                }, [
                    title_test("Onze bonzes de bronze", exact=True),
                    authors_test(['Max ANTHONY']),
                    series_test('Ned Lucas', 1)
                ]),
            (  # A book with nsfr_id:bk$5308$vl$-323559
                {
                    'identifiers': {
                        'nsfr_id': 'bk$5308$vl$-323559'
                    },
                    'title': "Le Printemps d'Helliconia",
                    'authors': ['B.W. Aldiss']
                }, [
                    title_test("Le Printemps d'Helliconia", exact=True),
                    authors_test(['Brian Aldiss']),
                    series_test('Helliconia', 1.0)
                ]),
            (  # A book with a wrong ISBN and title not quite right, will find one correct and 3 incorrect, correct is hightest priority...
                {
                    'identifiers': {
                        'isbn': '227721409x'
                    },
                    'title': "La Patrouille des temps",
                    'authors': ['Poul Anderson']
                }, [
                    title_test("La Patrouille du temps", exact=True),
                    authors_test(['Poul Anderson']),
                    series_test('La Patrouille du Temps', 1.0)
                ]),

            ##            ( # A book with no ISBN specified ... will fail over serie (serie is missing...)
            ##                {'identifiers':{}, 'title':"La Guerre contre le Rull", 'authors':['A.E. van Vogt']},
            ##                [title_test("La Guerre contre le Rull", exact=True), authors_test(['Alfred Elton VAN VOGT']), series_test('',0)]
            ##            ),

            ##            ( # A book with a HTTP Error 500
            ##                {'identifiers':{'isbn': '2-290-04457-1'}, 'title':"Le Monde de l'exil", 'authors':['David BRIN']},
            ##                [title_test("Le Monde de l'exil", exact=True), authors_test(['David Brin']), series_test('', 0)]
            ##            ),
        ])
예제 #22
0
파일: isbndb.py 프로젝트: MarioJC/calibre
            total_found += found
            candidates += results
            if total_found >= total or len(candidates) > 9:
                break

        return candidates
    # }}}


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


            (
                {'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)]
            ),
    ])
예제 #23
0
# 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)


# vim: expandtab:shiftwidth=4:tabstop=4:softtabstop=4:textwidth=80
예제 #24
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)]
            )
        ])
예제 #25
0
                    'isbn': '9780312621360'
                },
            }, [
                title_test('Flame: A Sky Chasers Novel', exact=True),
                authors_test(['Amy Kathleen Ryan'])
            ]),

        # Multiple authors and two part title and no general description
        ({
            'identifiers': {
                'jd': '0321180607'
            }
        }, [
            title_test(
                "XQuery From the Experts: A Guide to the W3C XML Query Language",
                exact=True),
            authors_test([
                'Howard Katz', 'Don Chamberlin', 'Denise Draper',
                'Mary Fernandez', 'Michael Kay', 'Jonathan Robie',
                'Michael Rys', 'Jerome Simeon', 'Jim Tivy', 'Philip Wadler'
            ]),
            pubdate_test(2003, 8, 22),
            comments_test('Jérôme Siméon'), lambda mi: bool(
                mi.comments and 'No title summary' not in mi.comments)
        ]),
    ]
    start, stop = 0, len(tests)

    tests = tests[start:stop]
    test_identify_plugin(JD.name, tests)
예제 #26
0
파일: google.py 프로젝트: Riva3000/calibre
                    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)]
            ),
    ])
# }}}
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)
            ]),
        (  # A book with a Shelfari id
            {
                'identifiers': {
                    'shelfari': '6977769'
                },
                'title': '61 Hours',
                'authors': ['Lee Child']
            }, [
                title_test('61 Hours', exact=True),
                authors_test(['Lee Child']),
                series_test('Jack Reacher', 14.0)
            ]),
    ])
예제 #28
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)]),
    ])
# }}}
예제 #29
0
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
        
        (# A book with title and author
            {'title':'나의 문화유산답사기 1', 'authors':['유홍준']},
            [title_test('나의 문화유산답사기 1', exact=False),
             authors_test(['유홍준'])]
        ), # 9788936470111
        
        (# A book with title and author
            {'identifiers':{'isbn': '9788984317475'}},
            [title_test('높고 푸른 사다리', exact=False),
             authors_test(['공지영'])]
        ), # 9788936470111
        
    ])
예제 #30
0
    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'])
            ])
    ]

    test_identify_plugin(Saxo.name, tests)
예제 #31
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': {'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'])])
        ]

    test_identify_plugin("Arxiv", tests_list)


# vim: expandtab:shiftwidth=4:tabstop=4:softtabstop=4:textwidth=80
예제 #32
0
    test_identify_plugin(Legie.name,
        [
#             (
#                 {'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': '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': '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)]
            )
        ])
예제 #33
0
    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권
            {
                'title':u"테메레르 큰바다뱀", 
            },
            [
                title_test(u"테메레르 6권 - 큰바다뱀들의 땅", exact=True),
                authors_test([u'나오미 노빅', u'공보경(역자)']),
                series_test('테메레르', 6.0)
            ]
        ),

        (# 나홀로 여행 컨설팅북
            {
                'title':u"나홀로 여행 컨설팅북", 
            },
            [
                title_test(u"나홀로 여행 컨설팅북", exact=True),
                authors_test([u'이주영']),
            ]
        )
    ], fail_missing_meta=False)
예제 #34
0
파일: overdrive.py 프로젝트: yws/calibre
            # 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'])
        ]),
    ])
    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'},
                 'title':'The Girl Hunters', 'authors':['Mickey Spillane']},
                [title_test('The Girl Hunters', exact=True),
                 authors_test(['Mickey Spillane']),
                 cover_test(None)]
            ),
            """

        ], fail_missing_meta=False)
예제 #36
0
                    'isbn': '9780312621360'
                },
            }, [
                title_test('Flame: A Sky Chasers Novel', exact=True),
                authors_test(['Amy Kathleen Ryan'])
            ]),

        # Multiple authors and two part title and no general description
        ({
            'identifiers': {
                'edelweiss': '0321180607'
            }
        }, [
            title_test(
                "XQuery From the Experts: A Guide to the W3C XML Query Language",
                exact=True),
            authors_test([
                'Howard Katz', 'Don Chamberlin', 'Denise Draper',
                'Mary Fernandez', 'Michael Kay', 'Jonathan Robie',
                'Michael Rys', 'Jerome Simeon', 'Jim Tivy', 'Philip Wadler'
            ]),
            pubdate_test(2003, 8, 22),
            comments_test('Jérôme Siméon'), lambda mi: bool(
                mi.comments and 'No title summary' not in mi.comments)
        ]),
    ]
    start, stop = 0, len(tests)

    tests = tests[start:stop]
    test_identify_plugin(Edelweiss.name, tests)
예제 #37
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']),
         ]
      ), 
    ]
)
예제 #38
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)]
            ),
    ])
# }}}

예제 #39
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'])]
            ),
    ])
예제 #40
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(['余华'])
                ]
            ),

        ])
예제 #41
0
 test_identify_plugin(LibRusEcMetadataSourcePlugin.name, [
     (
         {
             'identifiers': {'isbn': '9785932861578'},
             'title': u'Идору',
             'authors': u'Уильям Гибсон'
         },
         [
             title_test(u'Идору', exact=True),
             authors_test([u'Уильям Гибсон'])
         ]
     ),
     # (
     #     {
     #         'title': u'справочник',
     #         'identifiers': {'isbn': '9785932861578'}
     #     },
     #     [
     #         title_test(u'Python. Подробный справочник', exact=True),
     #         authors_test([u'Дэвид Бизли'])
     #     ]
     # ),
     # (
     #     {
     #         'title': u'Opencv Computer Vision',
     #         'authors': u'Howse'
     #     },
     #     [
     #         title_test(u'Opencv Computer Vision with Python', exact=True),
     #         authors_test([u'Joseph Howse'])
     #     ]
     # ),
 ])
예제 #42
0
# 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'])]),

        ]

    test_identify_plugin("Zentralblatt", tests_list)



# vim: expandtab:shiftwidth=4:tabstop=4:softtabstop=4:textwidth=80
 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": ["김훈"]},
             [
                 title_test("칼의 노래", exact=True),
                 authors_test(["김훈"]),
                 # series_test('Jack Reacher', 14.0),
                 cover_test("http://image.yes24.com/goods/6185205/L"),
             ],
         ),
         """
         (# A book with an NA cover
             {'identifiers':{'isbn':'9780451063953'},
              'title':'The Girl Hunters', 'authors':['Mickey Spillane']},
             [title_test('The Girl Hunters', exact=True),
              authors_test(['Mickey Spillane']),
              cover_test(None)]
         ),
         """,
     ],
     fail_missing_meta=False,
 )
예제 #44
0
파일: google.py 프로젝트: JimmXinu/calibre
    # }}}


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[:])

# }}}
예제 #45
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'])
    ])])
예제 #46
0
    test_identify_plugin(Pitaval.name,
        [
#             (
#                 {'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)]
#             )
#             ,
#             (
#                 {'identifiers':{},
#                 'title': 'Tajemství ulice', 'authors':['Pitt Strong']},
#                 [title_test('Tajemství ulice', exact=False)]
#             )
#             ,
#            (
#                {'identifiers':{},
#                'title': 'Nevadský plyn', 'authors':['Raymond Chandler']},
#                [title_test('Nevadský plyn', exact=False)]
#            )
])
예제 #47
0
    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(['유홍준'])]
            ),
            
            (# A book with an ISBN
                {'identifiers':{'isbn': '9788993824698'},
                    'title':'61시간', 'authors':['리 차일드']},
                [title_test('61시간', exact=True),
                 authors_test(['리 차일드','박슬라']),
                 series_test('잭 리처 시리즈', 0.0)]
            ),
            
            # TODO: Books that hasn't isbn.
            
            # rating 이 0 인 도서들( 외국도서 등)에서는 테스트할 때 멈춘다.
            # (# A book with a Aladin id
            #     {'identifiers':{'aladin.co.kr': '0440243696'},
            #         'title':'61 Hours', 'authors':['Lee Child']},
            #     [title_test('61 Hours (Paperback, Reprint) - A Reacher Novel', exact=True),
            #      authors_test(['Lee Child']),
            #     # series_test('Jack Reacher', 14.0)
            #     ]
            # ),
            # (# 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 with an ISBN
            #     {'identifiers':{'isbn': '9780385340588'},
            #         'title':'61 Hours', 'authors':['Lee Child']},
            #     [title_test('61 Hours (Hardcover)', exact=True),
            #      authors_test(['Lee Child'])]
            # ),#,series_test('A Reacher Novel', 14.0)
            # 
            # (# A book with an ISBN
            #     {'identifiers':{'isbn': '780804194587'},
            #         'title':'Personal', 'authors':['Lee Child']},
            #     [title_test('Personal', 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)]
            # ),

            # TODO: Testing code error when rating value is 0.0
            # (# A book with an ISBN
            #  # resutlt : Failed to find rating
            #  # rating 값이 0인 예.
            #     {'identifiers':{'isbn': '9788978011136'},
            #         'title':'금강삼매경론', 'authors':['원효']},
            #     [title_test('금강삼매경론 -상', exact=True),
            #      authors_test(['원효','조용길']),
            #     # series_test('', 0.0)
            #      ]
            # ),
            

        ])
예제 #48
0
    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)]
#             )
#            ,
#             (
#                 {'identifiers':{'dbknih': 'povidky/carovny-svet-henry-kuttnera-2882/absolon-11582'}, #short story
#                 'title': 'Absolon', 'authors':['Henry Kuttner']},
#                 [title_test('Absolon', exact=False)]
#             )
#             ,
#             (
#                 {'identifiers':{}, #short story
#                 'title': 'Dilvermoon', 'authors':['Raymon Huebert Aldridge']},
#                 [title_test('Dilvermoon', exact=False)]
#             )
#             ,
#           (
#                {'identifiers':{}, #short story
#                'title': 'Vlk', 'authors':['Eric Eliot Knight']},
#                [title_test('Vlk', exact=False)]
#            )
#           (
#                {'identifiers':{}, #bug
#                'title': '2001: Vesmírná odysea', 'authors':['Arthur C. Clarke']},
#                [title_test('2001: Vesmírná odysea', exact=False)]
#            )
#           (
#                {'identifiers':{}, #short story
#                'title': 'Kruh', 'authors':['Dave Eggers']},
#                [title_test('Kruh', exact=False)]
#            )
        ])
예제 #49
0
            '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'])
        ]),
    ]

    test_identify_plugin("Zentralblatt", tests_list)

# vim: expandtab:shiftwidth=4:tabstop=4:softtabstop=4:textwidth=80
    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)]
            ),

            (# A book with a Shelfari id
                {'identifiers':{'shelfari': '6977769'},
                    'title':'61 Hours', 'authors':['Lee Child']},
                [title_test('61 Hours', exact=True),
                 authors_test(['Lee Child']),
                 series_test('Jack Reacher', 14.0)]
            ),

        ])
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
        (  # A book with title and author
            {
                'title': '나의 문화유산답사기 1',
                'authors': ['유홍준']
            }, [
                title_test('나의 문화유산답사기 1', exact=False),
                authors_test(['유홍준'])
            ]),  # 9788936470111
        (  # A book with title and author
            {
                'identifiers': {
                    'isbn': '9788984317475'
                }
            },
            [title_test('높고 푸른 사다리', exact=False),
             authors_test(['공지영'])]),  # 9788936470111
    ])
예제 #52
0
    from calibre.ebooks.metadata.sources.test import (
        test_identify_plugin, title_test, authors_test, comments_test, pubdate_test)
    tests = [
        (  # A title and author search
         {'title': 'The Husband\'s Secret', 'authors':['Liane Moriarty']},
         [title_test('The Husband\'s Secret', exact=True),
                authors_test(['Liane Moriarty'])]
        ),

        (  # An isbn present in edelweiss
         {'identifiers':{'isbn': '9780312621360'}, },
         [title_test('Flame: A Sky Chasers Novel', exact=True),
                authors_test(['Amy Kathleen Ryan'])]
        ),

        # Multiple authors and two part title and no general description
        ({'identifiers':{'edelweiss':'0321180607'}},
        [title_test(
        "XQuery From the Experts: A Guide to the W3C XML Query Language"
        , exact=True), authors_test([
            'Howard Katz', 'Don Chamberlin', 'Denise Draper', 'Mary Fernandez',
            'Michael Kay', 'Jonathan Robie', 'Michael Rys', 'Jerome Simeon',
            'Jim Tivy', 'Philip Wadler']), pubdate_test(2003, 8, 22),
            comments_test('Jérôme Siméon'), lambda mi: bool(mi.comments and 'No title summary' not in mi.comments)
        ]),
    ]
    start, stop = 0, len(tests)

    tests = tests[start:stop]
    test_identify_plugin(Edelweiss.name, tests)
예제 #53
0
                log.error(self.ExHentai_Cookies)
                return
        gidlist = self.get_gallery_info(log,raw)
        if not gidlist:
            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)]
            )
    ])
# }}}
예제 #54
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"])],
            ),
        ],
    )
예제 #55
0
    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(['유홍준'])]
            ),
            
            (# A book with an ISBN
                {'identifiers':{'isbn': '9788993824698'},
                    'title':'61시간', 'authors':['리 차일드']},
                [title_test('61시간', exact=True),
                 authors_test(['리 차일드','박슬라']),
                 series_test('잭 리처 시리즈', 0.0)]
            ),
            
            # TODO: Books that hasn't isbn.
            
            # rating 이 0 인 도서들( 외국도서 등)에서는 테스트할 때 멈춘다.
            # (# A book with a Aladin id
            #     {'identifiers':{'aladin.co.kr': '0440243696'},
            #         'title':'61 Hours', 'authors':['Lee Child']},
            #     [title_test('61 Hours (Paperback, Reprint) - A Reacher Novel', exact=True),
            #      authors_test(['Lee Child']),
            #     # series_test('Jack Reacher', 14.0)
            #     ]
            # ),
            # (# 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 with an ISBN
            #     {'identifiers':{'isbn': '9780385340588'},
            #         'title':'61 Hours', 'authors':['Lee Child']},
            #     [title_test('61 Hours (Hardcover)', exact=True),
            #      authors_test(['Lee Child'])]
            # ),#,series_test('A Reacher Novel', 14.0)
            # 
            # (# A book with an ISBN
            #     {'identifiers':{'isbn': '780804194587'},
            #         'title':'Personal', 'authors':['Lee Child']},
            #     [title_test('Personal', 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)]
            # ),

            # TODO: Testing code error when rating value is 0.0
            # (# A book with an ISBN
            #  # resutlt : Failed to find rating
            #  # rating 값이 0인 예.
            #     {'identifiers':{'isbn': '9788978011136'},
            #         'title':'금강삼매경론', 'authors':['원효']},
            #     [title_test('금강삼매경론 -상', exact=True),
            #      authors_test(['원효','조용길']),
            #     # series_test('', 0.0)
            #      ]
            # ),
            

        ])