diff --git a/core/isbn.py b/core/isbn.py index 4231087d..152ce452 100644 --- a/core/isbn.py +++ b/core/isbn.py @@ -111,9 +111,9 @@ class ISBN(object): else: return self.__isbn13 def __unicode__(self): - return unicode(self.to_string(type='13',hyphenate=False)) + return unicode(self.to_string(type=self.type,hyphenate=False)) def __str__(self): - return self.to_string(type='13',hyphenate=False) + return self.to_string(type=self.type,hyphenate=False) def __eq__(self, other): """ both equal if both valid checksums and ISBN 13 equal """ if isinstance(other, ISBN): diff --git a/core/tests.py b/core/tests.py index db3db987..6c446aa5 100755 --- a/core/tests.py +++ b/core/tests.py @@ -347,7 +347,7 @@ class ISBNTest(TestCase): self.assertEqual(isbn.ISBN(python_10).to_string(10,True), '0-672-32978-6') # check casting to string -- ISBN 13 - self.assertEqual(str(isbn.ISBN(python_10)), '9780672329784') + self.assertEqual(str(isbn.ISBN(python_10)), '0672329786') # test __eq__ and __ne__ and validate self.assertTrue(isbn.ISBN(milosz_10) == isbn.ISBN(milosz_13)) @@ -360,7 +360,8 @@ class ISBNTest(TestCase): # curious about set membership self.assertEqual(len(set([isbn.ISBN(milosz_10), isbn.ISBN(milosz_13)])),2) - self.assertEqual(len(set([str(isbn.ISBN(milosz_10)), str(isbn.ISBN(milosz_13))])),1) + self.assertEqual(len(set([str(isbn.ISBN(milosz_10)), str(isbn.ISBN(milosz_13))])),2) + self.assertEqual(len(set([isbn.ISBN(milosz_10).to_string(), isbn.ISBN(milosz_13).to_string()])),1) def suite():