stdnum 0.6 is packaged with Ubuntu precise
_______________ TestCosmeticChangesISBN.test_ignore_invalid_isbn _______________ self = <tests.isbn_tests.TestCosmeticChangesISBN testMethod=test_ignore_invalid_isbn> def test_ignore_invalid_isbn(self): """Test fixing ISBN numbers with an invalid ISBN.""" cc = CosmeticChangesToolkit(self.site, namespace=0, ignore=CANCEL_MATCH) > text = cc.fix_ISBN(' ISBN 0975229LOL ISBN 9780975229804 ') tests/isbn_tests.py:75: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pywikibot/cosmetic_changes.py:996: in fix_ISBN text, strict=False if self.ignore == CANCEL_MATCH else True) pywikibot/cosmetic_changes.py:195: in _reformat_ISBNs text, lambda match: _format_isbn_match(match, strict=strict)) pywikibot/textlib.py:1712: in reformat_ISBNs text = isbnR.sub(match_func, text) pywikibot/cosmetic_changes.py:195: in <lambda> text, lambda match: _format_isbn_match(match, strict=strict)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ match = <_sre.SRE_Match object at 0xa658a08>, strict = False def _format_isbn_match(match, strict=True): """Helper function to validate and format a single matched ISBN.""" scripts_isbn = None if not stdnum_isbn: # For backwards compatibility, if stdnum.isbn is not available # attempt loading scripts.isbn as an alternative implementation. try: import scripts.isbn as scripts_isbn except ImportError: raise NotImplementedError( 'ISBN functionality not available. Install stdnum package.') warn('package stdnum.isbn not found; using scripts.isbn', ImportWarning) isbn = match.group('code') if stdnum_isbn: try: stdnum_isbn.validate(isbn) > except stdnum_isbn.ValidationError as e: E AttributeError: 'module' object has no attribute 'ValidationError' pywikibot/cosmetic_changes.py:163: AttributeError __________________ TestCosmeticChangesISBN.test_invalid_isbn ___________________ self = <tests.isbn_tests.TestCosmeticChangesISBN testMethod=test_invalid_isbn> def test_invalid_isbn(self): """Test that it'll fail when the ISBN is invalid.""" cc = CosmeticChangesToolkit(self.site, namespace=0) # Invalid characters self.assertRaises(AnyIsbnValidationException, > cc.fix_ISBN, 'ISBN 0975229LOL') tests/isbn_tests.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pywikibot/cosmetic_changes.py:996: in fix_ISBN text, strict=False if self.ignore == CANCEL_MATCH else True) pywikibot/cosmetic_changes.py:195: in _reformat_ISBNs text, lambda match: _format_isbn_match(match, strict=strict)) pywikibot/textlib.py:1712: in reformat_ISBNs text = isbnR.sub(match_func, text) pywikibot/cosmetic_changes.py:195: in <lambda> text, lambda match: _format_isbn_match(match, strict=strict)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ match = <_sre.SRE_Match object at 0xa83e4e0>, strict = True def _format_isbn_match(match, strict=True): """Helper function to validate and format a single matched ISBN.""" scripts_isbn = None if not stdnum_isbn: # For backwards compatibility, if stdnum.isbn is not available # attempt loading scripts.isbn as an alternative implementation. try: import scripts.isbn as scripts_isbn except ImportError: raise NotImplementedError( 'ISBN functionality not available. Install stdnum package.') warn('package stdnum.isbn not found; using scripts.isbn', ImportWarning) isbn = match.group('code') if stdnum_isbn: try: stdnum_isbn.validate(isbn) > except stdnum_isbn.ValidationError as e: E AttributeError: 'module' object has no attribute 'ValidationError' pywikibot/cosmetic_changes.py:163: AttributeError ___________________ TestCosmeticChangesISBN.test_valid_isbn ____________________ self = <tests.isbn_tests.TestCosmeticChangesISBN testMethod=test_valid_isbn> def test_valid_isbn(self): """Test ISBN.""" cc = CosmeticChangesToolkit(self.site, namespace=0) > text = cc.fix_ISBN(' ISBN 097522980x ') tests/isbn_tests.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pywikibot/cosmetic_changes.py:996: in fix_ISBN text, strict=False if self.ignore == CANCEL_MATCH else True) pywikibot/cosmetic_changes.py:195: in _reformat_ISBNs text, lambda match: _format_isbn_match(match, strict=strict)) pywikibot/textlib.py:1712: in reformat_ISBNs text = isbnR.sub(match_func, text) pywikibot/cosmetic_changes.py:195: in <lambda> text, lambda match: _format_isbn_match(match, strict=strict)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ match = <_sre.SRE_Match object at 0xa83e6c0>, strict = True def _format_isbn_match(match, strict=True): """Helper function to validate and format a single matched ISBN.""" scripts_isbn = None if not stdnum_isbn: # For backwards compatibility, if stdnum.isbn is not available # attempt loading scripts.isbn as an alternative implementation. try: import scripts.isbn as scripts_isbn except ImportError: raise NotImplementedError( 'ISBN functionality not available. Install stdnum package.') warn('package stdnum.isbn not found; using scripts.isbn', ImportWarning) isbn = match.group('code') if stdnum_isbn: try: stdnum_isbn.validate(isbn) > except stdnum_isbn.ValidationError as e: E AttributeError: 'module' object has no attribute 'ValidationError' pywikibot/cosmetic_changes.py:163: AttributeError ____________________________ TestIsbn.test_general _____________________________ self = <tests.isbn_tests.TestIsbn testMethod=test_general> def test_general(self): """Test things that apply both to ISBN10 and ISBN13.""" # getIsbn self.assertIsInstance(getIsbn('097522980x'), ISBN10) self.assertIsInstance(getIsbn('9783161484100'), ISBN13) self.assertRaisesRegex(IsbnExc, 'ISBN-13: The ISBN 097522 is not 13 digits ' 'long. / ISBN-10: The ISBN 097522 is not 10 ' 'digits long.', getIsbn, '097522') # hyphenateIsbnNumbers > self.assertEqual(hyphenateIsbnNumbers('ISBN 097522980x'), 'ISBN 0-9752298-0-X') tests/isbn_tests.py:131: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pywikibot/textlib.py:1712: in reformat_ISBNs text = isbnR.sub(match_func, text) scripts/isbn.py:1396: in _hyphenateIsbnNumber is_valid(isbn) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ isbn = '097522980X' def is_valid(isbn): """Check whether an ISBN 10 or 13 is valid.""" # isbnlib marks any ISBN10 with lowercase 'X' as invalid isbn = isbn.upper() try: stdnum.isbn except NameError: pass else: try: stdnum.isbn.validate(isbn) > except stdnum.isbn.InvalidFormat as e: E AttributeError: 'module' object has no attribute 'InvalidFormat' scripts/isbn.py:1370: AttributeError ________________________ TestIsbnWikibaseBot.test_isbn _________________________ self = <tests.isbn_tests.TestIsbnWikibaseBot testMethod=test_isbn> def test_isbn(self): """Test using the bot and wikibase.""" main('-page:' + self.test_page_qid, '-always', '-format') > self.assertEqual(self.setTarget_value, '0-9752298-0-X') E AttributeError: 'TestIsbnWikibaseBot' object has no attribute 'setTarget_value' tests/isbn_tests.py:241: AttributeError