convert between ibsn 10 and 13

This commit is contained in:
Mouse Reeve
2020-10-29 12:32:37 -07:00
parent 90cccc455e
commit 7febcec229
7 changed files with 97 additions and 24 deletions

View File

@ -2,6 +2,7 @@
from django.test import TestCase
from bookwyrm import models, settings
from bookwyrm.models.book import isbn_10_to_13, isbn_13_to_10
class Book(TestCase):
@ -48,6 +49,16 @@ class Book(TestCase):
self.assertEqual(self.work.default_edition, self.second_edition)
def test_isbn_10_to_13(self):
isbn_10 = '178816167X'
isbn_13 = isbn_10_to_13(isbn_10)
self.assertEqual(isbn_13, '9781788161671')
def test_isbn_13_to_10(self):
isbn_13 = '9781788161671'
isbn_10 = isbn_13_to_10(isbn_13)
self.assertEqual(isbn_10, '178816167X')
class Shelf(TestCase):
def setUp(self):