Permalink
Browse files

adding new test data for isbn code, and additional test code

  • Loading branch information...
1 parent 4b698ce commit 3d1b15c6cd68fcfffb09197c71057885fd041792 @anarchivist anarchivist committed Dec 17, 2009
Showing with 11 additions and 0 deletions.
  1. +1 −0 test/multi_isbn.dat
  2. +10 −0 test/record.py
View
1 test/multi_isbn.dat
@@ -0,0 +1 @@
+00794pam a2200241 i 4500001000800000005001700008008004100025035002100066906004500087010001700132020002200149020003300171020002900204040001800233050002500251082002500276100002700301245007400328260004900402300002800451490002200479991005100501461219520050208133419.0771025s1977 vtua 000 0 eng  9(DLC) 77017192 a7bcbccorignewd1eocipf19gy-gencatlg a 77017192  a0914378287 (v. 1) a0914378295 (lim. ed.) (v. 1) a0914378260 (pbk.) (v. 1) aDLCcDLCdDLC00aPS3569.H44bW3 pt. 100a811/.5/4 sa811/.5/41 aJohnson, Judith Emlyn.14aThe town scold /cby Judith Johnson Sherwin ; ill. by Margaret Lampe. aTaftsville, Vt. :bCountryman Press,cc1977. a39 p. :bill. ;c23 cm.0 aHer Waste ; pt. 1 bc-GenCollhPS3569.H44iW3 pt. 1tCopy 1wBOOKS
View
10 test/record.py
@@ -1,5 +1,6 @@
import unittest
+from pymarc.reader import MARCReader
from pymarc.record import Record
from pymarc.field import Field
from pymarc.exceptions import BaseAddressInvalid, RecordLeaderInvalid
@@ -97,6 +98,15 @@ def test_isbn(self):
record = Record()
record.add_field(Field('020', [0, 1], subfields=['a', 'ISBN-978-1416566113']))
self.assertEquals(record.isbn(), '9781416566113')
+
+ record = Record()
+ record.add_field(Field('020', [' ', ' '], subfields=['a', '0456789012 (reel 1)']))
+ self.assertEquals(record.isbn(), '0456789012')
+
+ def test_multiple_isbn(self):
+ reader = MARCReader(file('test/multi_isbn.dat'))
+ record = reader.next()
+ self.assertEquals(record.isbn(), '0914378287')
def test_author(self):
record = Record()

0 comments on commit 3d1b15c

Please sign in to comment.